[Novalug] how to change file names for CAPITALS to lower case
angelo at freeshell.org
Wed Feb 14 21:48:09 EST 2007
> On Wed, 2007-02-14 at 19:22 -0500, Angelo Bertolli wrote:
>> Nino Pereira wrote:
>>> This topic was discussed once before, but I forgot
>>> the conclusion. Can anyone remind me of the answer?
>>> I have a directory with lots of files, with file names
>>> in capitals. I want to change all the file names
>>> to lower case.
>> I'll make a guess:
>> ls | while read file
>> new=`echo $file | tr [:upper:] [:lower:]`
>> mv -v "$file" "$new"
> What about the possible there are directories mixed in with the files?
> Not sure what your version would do.
> What about the case where a LOWERCASE version of the file name already
> Your version would REPLACE the original LOWERCASE version with the
> date from the uppercase version.
Yes, you're right. I can use [ -f and [ -e for those conditions
Also... I put quotes around $file and $new to account for spaces in
filenames, but I wasn't sure if spaces would mess up new=`...` also.
Please remove my email address from your post when replying
[Tech http://bitfreedom.com | Gaming http://heroesonly.com]
More information about the Novalug