commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
Handles spaces in file names and directories. Optionally change directories as well by pipe to tr from dirname.
There is 1 alternative - vote for the best!
The simplest way I know.
or, to process a single directory:
for f in *; do mv $f `echo $f |tr '[:upper:]' '[:lower:]'`; done
This will convert filenames from uppercase to lowercase. I find this useful after downloading images from my digital camera. This works for English, but other languages may need something slightly more complex like this:
for i in *; do mv "$i" "$(echo $i|tr [:upper:] [:lower:])"; done
Also, the quote marks aren't necessary if your filenames don't contain spaces.
easier way to recursively change files to lowercase using rename instead
If you can do better, submit your command here.
You must be signed in to comment.