bash help renaming files
Hello everybody...
I have a lot of mp3s from windows... and all of them have spaces and caps... I want to rename all the files so that empty spaces become _ (underscores) and all the capital letters become lowercase... Can anybody help me out? Thanks a lot! Martin Seidl Fc3/2.6.9-1.667 |
I don't get the point, but...
If you're using KDE, you can try krename. If not, a freshmeat search http://freshmeat.net/rename might help. No file managers I know of has trouble handling spaces in filename, and they're not really any trouble in bash either, i.e. "Artist<tab> |
Here is a simple script that should do it. Run it in the directory you want to convert.
Code:
for name in *; do |
in order to do this recursively and change only the mp3 that have those problems try:
Code:
find . -type f -name "*.[Mm][Pp]3" | while read name; do Code:
new_name=$(echo -n "${name%/*}/";echo -n "${name##*/}"|tr -s " "|tr ' [A-Z]' '_[a-z]'); |
cani add this to work in multiple directories?
|
nevermind... hey, thanks a lot for you guys... this was helpful and educational.
you should all be knighted! oh wait, thats only the ms devil that gets to be nighted. |
Quote:
|
All times are GMT -5. The time now is 04:28 PM. |