Quote:
Originally Posted by littlejoe5
The following script works really well within any one directory.
(I did not write it, and don't remember where I got it, but I have modified it a little. I removed the tr call that converted capitals to lower case.)
~ $ cat bin/nfname.sh
#!/bin/bash
#"nfname" means "normalize Filename", It is intended to remove unacceptable symbols from filenames.
ls | while read -r FILE
do
mv -v "$FILE" `echo $FILE | tr ' ' '_' | tr -d '[{}(),\!]' | tr -d "\'" | sed 's/_-_/_/g'`
done
Now how can I make it loop through all the directories from /home?
|
Please put your code in CODE tags when posting. Also, please read the "Question Guidelines" link in my posting signature. We will be happy to help, but you will have to provide some effort. You've been here nine years now, and surely have seen many threads like this in that time.
Also, any of the bash scripting tutorials cover this, as well as a brief Google search for "bash script recurse into directories"...like this one, complete with examples:
http://askubuntu.com/questions/53148...ecuting-script