[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Sheflug] Batch Process Photographs
[16/07/09 14:36] Andy (Beta) wrote:
> In Bash:
>
> rename dsc holiday *.jpg
>
> Will change the first instance of 'dsc' found in a file name to
> 'holiday' and will do this to all the files ending with '.jpg' in the
> directory.
Careful! There are two (at least?) different versions of the rename
command floating around. The one I'm used to these days takes a Perl
substitution argument:
rename 's/dsc/holiday/' *.jpg
(renames the first "dsc" in each filename)
rename 's/dsc/holiday/g' *.jpg
(renames every "dsc" in each filename)
rename 's/\s+/_/g' *
(flattens all series of annoying spaces in filenames to underscores)
It also has a useful -n option for a dry run (print what it would have
renamed, then you can try again without -n if you like what you see).
_______________________________________________
Sheffield Linux User's Group
http://sheflug.org.uk/mailman/listinfo/sheflug_sheflug.org.uk
FAQ at: http://www.sheflug.org.uk/mailfaq.html
GNU - The Choice of a Complete Generation