aperahama Posted February 25, 2004 Report Share Posted February 25, 2004 Hi Can anybody tell me if there is an easy/quick way of converting file names from from upper to lower case letters and vice-versa. I have some programmes that run on both Windoes and Linux but the data files have not been set up correctly to deal with case sensitive file names. Its a bit of a fag having to retype each one individaully. Thanks for any help you may be able to give. (I'm running Mandrake 9.2, if that makes any difference) Quote Link to comment Share on other sites More sharing options...
Cannonfodder Posted February 25, 2004 Report Share Posted February 25, 2004 Try opening a console and type man rename to explore the rename command. Read carefully and backup your work first so you can experiment.. Quote Link to comment Share on other sites More sharing options...
aperahama Posted February 25, 2004 Author Report Share Posted February 25, 2004 Thanks for the quick reply cannonfodder. I'm heading for a terminal window now. :D Quote Link to comment Share on other sites More sharing options...
neutro Posted February 25, 2004 Report Share Posted February 25, 2004 Wow it's the first time I see this. I want the hours I spent renaming my files back. Quote Link to comment Share on other sites More sharing options...
aRTee Posted February 25, 2004 Report Share Posted February 25, 2004 Anyone telling the command line is second to a gui has not had to rename lots of files. rename is really nice, as is the command line interface. You just have to know it... Or know that you have to ask here... :P Quote Link to comment Share on other sites More sharing options...
aru Posted February 25, 2004 Report Share Posted February 25, 2004 (edited) Try opening a console and type man rename to explore the rename command. Read carefully and backup your work first so you can experiment.. Rename does the trick, but here are a couple of other ways to do it in a more *purist* point of view: Converting files from upper case to lower case in a *single* directory: ~$ for file in *; do mv "${file}" "$(echo $file | tr 'A-Z' 'a-z')"; done Recursively: ~$ find ./ -type f -exec bash -c 'f=$(basename "$1"); d=$(dirname "$1"); mv -i "$d/$f" "$d/$(echo $f|tr "A-Z" "a-z")"' {} {} \; Edited February 25, 2004 by aru Quote Link to comment Share on other sites More sharing options...
Gowator Posted February 25, 2004 Report Share Posted February 25, 2004 aru, How about a bit shift example for the really pure.... I was considering it but couldn't work out how to do it in a shell script :D Quote Link to comment Share on other sites More sharing options...
Cannonfodder Posted February 25, 2004 Report Share Posted February 25, 2004 Anytime you are doing something that you think is repetative and takes a long time, there's good odds that someone else has a quicker way! Doesn't surprise me that the script fanatics have reared their heads in this thread Quote Link to comment Share on other sites More sharing options...
Gowator Posted February 25, 2004 Report Share Posted February 25, 2004 If aru doesn't post a bit shift one then I'll post one and he'll have to correct it! Erm, im not sure aru's way is quicker but its sure more flexible... + it comes with a I learned something cool today certificate :D Quote Link to comment Share on other sites More sharing options...
aru Posted February 25, 2004 Report Share Posted February 25, 2004 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.