[Malvern] One for the Perl-mongers.
Angus Clarke
post at angusclarke.com
Sun Jul 15 19:31:54 BST 2007
Yeah, just read Richard's email, the following ammendments should get
around spacing issues:
#! /bin/bash
IFS=$'\n'
DIR=/dir/to/files # Change this!
cd ${DIR}
for FILE in `ls`
do
NEWNAME=`echo "${FILE}" | tr [:upper:] [:lower:]`
echo "Renaming ${FILE} to ${NEWNAME}"
mv "${FILE}" "${NEWNAME}"
done
Setting IFS at the start changes the default Input Field Seperator
I have also put double quotes around the filename variables, so that
whitespace is read as part of the filename
Angus Clarke wrote:
> I havent tried it but a little script like this should work:
>
> <-- snip
> #! /bin/bash
>
> DIR=/dir/to/files # Change this!
>
> cd ${DIR}
> for FILE in `ls`
> do
> NEWNAME=`echo ${FILE} | tr [:upper:] [:lower:]`
> echo "Renaming ${FILE} to ${NEWNAME}"
> mv ${FILE} ${NEWNAME}
> done
> <-- snip
>
> Regards
> Angus
>
> Geoff Bagley 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