Click to See Complete Forum and Search --> : Making all filenames lower case
Bradmont2
05-01-2001, 07:55 PM
This is what I have so far:
for i in *; do new=${i//[A-Z]/[a-z]} ; mv "$i" $new; done
(if you cant tell, I'm very new to bash scripting ;) )
All the correct characters are replaced, but what they're replaced with you can see is wrong... can anybody tell me what I should do?
Thanx.
Ben Briggs
05-01-2001, 08:44 PM
I don't know if you want the job done, or to practice your bash, but if you want the job done... nocaps.py (http://briggs.250x.com/python/nocaps.py).
I you are practicing bash... sorry I can't help :(
Bradmont2
05-01-2001, 09:30 PM
Hrrrms.. I was sorta practicing my bash, but thanks anyway. If nobody can help me fix the bit I've got now, I'll use yours :)
jemfinch
05-01-2001, 10:43 PM
Consider just learning python instead of bash. It'll be more cross-platform (you can use it in windows too,) it'll be more ubiquitous (more *nices have python than bash) and it's a far better language for real programming.
Jeremy
Bradmont2
05-02-2001, 01:53 AM
Hrrms... the python script didn't work :(
jemfinch
05-02-2001, 01:07 PM
Whoa...if only all bug reports were that descriptive. :rolleyes:
What didn't work about it?
Jeremy
Bradmont2
05-02-2001, 06:50 PM
Heh, sorry... It did print all the filenames as they were, and then again in lower case, but it didn't rename any of the files.
But anyway, I figured out a way to do it (it's too ugly to mention here, tho...)
jemfinch
05-03-2001, 01:31 AM
I just ran the code myself, and it works for me. What was your workaround?
Jeremy