[Malvern] One for the "It's Simple Enough For Bash"-mongers.
Richard Forster
rick at forster.uklinux.net
Sun Jul 15 19:05:07 BST 2007
Google broken again eh Geoff?
To lower-case all files in your current directory use:
for i in * ; do mv $i `echo $i | tr [A-Z] [a-z]` ; done
you may wish to use *.[Jj][Pp][Gg] to trap all the case variances of
JPG, Jpg, jpg etc and not touch other files you might have there.
you may also wish to look up mv -i before running anything like this.
it doesn't work on files containing spaces but I have another script for
that.
My nautilus-scripts folder contains the following which does exactly the
same job, I use the above more often but there are times when a GUI file
manager is handy
#!/bin/sh
# lowercase any filenames with uppercase chars
for file in $*
do
if [ -f $file ]
then
lcfile=`echo $file | tr [:upper:] [:lower:]`
if [ $file != $lcfile ]
then
mv -i $file $lcfile
fi
fi
done
Programs such as gqview have a duplicates detection capability if you
want to hunt them out too.
Cheers
Rick
Phil Ironside wrote:
> Hi Geoff
>
> You can download chcase form
> http://www.blemished.net/chcase.html
> There seems to be a problem with the site at the moment so I will email it to
> you when I access my server later.
>
> Learn more about it at http://wiki.christophchamp.com/index.php/Chcase
>
> Put it in your path something like /usr/local/bin and make it executable and
> then in the directory where you want to change all the files to lowercase type
> chcase. You can also use it to replace letters in file names
>
> Geoff Bagley <geoff.bagley at btinternet.com> wrote:
>
>> I have a number of .jpeg file ( photographs etc.), and would like to
>> convert the file names
>> of the whole lot to lower case.
>>
>> Currently some are both .jpg and .JPG, and both img_ and IMG_ and
>> the same files are
>> stored more than once. The files all come from various sources who use
>> differing standards.
>>
>> Storing very large files (like photos) is very wastful of space.
>>
>> A quick steer to the correct page of the (RT)FM would be appreciated.
>>
>> Geoff.
>>
>>
>> _______________________________________________
>> Malvern mailing list
>> Malvern at mailman.lug.org.uk
>> https://mailman.lug.org.uk/mailman/listinfo/malvern
>>
>
>
>
>
> _______________________________________________
> Malvern mailing list
> Malvern at mailman.lug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/malvern
>
>
More information about the Malvern
mailing list