Operating Systems > Linux and UNIX
Converting filenames to lowercase
Agent007:
Hi all,
Is it possible to convert multiple filenames in a directory to lowercase? how?
thanks,
007
Faust:
Try a shell script. I'm guessing it would involve "for file in $1" and tr, but I'm not sure. I would like to hear how you do it because I'm interested in a similar thing. Also converting spaces to underscores would be good too. ;)
Pantso:
Can you believe that I had a similar question myself? I think that a shell script would propably do the job as Faust wrote, but I really suck at shell scripting. :rolleyes:
So, if anyone has an answer to this, could you please share it with us?
Stryker:
quote:Originally posted by Faust:
Try a shell script. I'm guessing it would involve "for file in $1" and tr, but I'm not sure. I would like to hear how you do it because I'm interested in a similar thing. Also converting spaces to underscores would be good too. ;)
--- End quote ---
for the underscore i believe something like:
ls | while read item; do mv "$item" `echo "$item" | sed 's/\ /_/g'`; done
might want to double check on the sed part, s and g might need to be reversed. it's been a while but that should work. for subdirectories you could do find instead of ls
solo:
--- Code: ---
--- End code ---
:-D
Navigation
[0] Message Index
[#] Next page
Go to full version