On Thu, Feb 19, 2009 at 9:26 PM, Daniel Escasa <[email protected]> wrote: > Sabi ko noong Thu, Feb 19, 2009 at 9:23 PM: >> Anyone know of a good utility to traverse a directory tree and change the >> case of filenames? I copied files from a USB stick, and they were uppercase > > BTW, I've tried Google (ako pa :)
hi danny, as like i said... if you cant find in google.. you can find it here in plug :-> the commands below regardless they are uppercase or lowercase or combination of both... it will convert all to lowercase both for directories and filenames... 1. cd to your starting directory 2. execute the command below to convert first all the directories into lowercase.. for x in `find * -type d`; do f=`echo $x|tr [A-Z] [a-z]`; mv $x $f+danny; mv $f+danny $f; done 3. then execute the command below to convert all the filenames into lowercase... for x in `find * -type f`; do f=`echo $x|tr [A-Z] [a-z]`; mv $x $f+danny; mv $f+danny $f; done "mv" command cannot move or rename a file with the same source and destination values (eg. the file or directory is already in lowercase like "mv abc abc" produced an error) thus i append the string "+danny" to circumvent that problem... fooler. _________________________________________________ Philippine Linux Users' Group (PLUG) Mailing List http://lists.linux.org.ph/mailman/listinfo/plug Searchable Archives: http://archives.free.net.ph

