Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Also... | 9 comments | Create New Account
Click here to return to the 'Also...' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Also...
Authored by: pwharff on Mar 25, '04 03:00:36PM

I forgot to mention with the last script, that if other files in the same directory that do not have spaces in them will be ignored and untouched, however the script will return an error with the "mv" command. So that this is ignored, you could modify the script to send stnderr to /dev/null, that way no matter what, your script will run smoothly. Like such:

[code]
for file in * ; do
mv "$file" $(echo "$file" | sed 's/ /_/g') 2> /dev/null
done
[/code]
or
[code]
for file in * ; do mv "$file" $(echo "$file" | sed 's/ /_/g') 2> /dev/null ; done
[/code]



[ Reply to This | # ]