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

Click here to return to the 'Alternate Method' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Alternate Method
Authored by: THEM on Jun 12, '02 12:01:44PM
Here's an alternate script that gets rid of space in file names. cd to the folder with files you want to change then run this script. If you'd prefer to make spaces an underscore, swap the comment lines.
#! /bin/sh

for n in *
NewName=`echo $n | tr -d " "`
#NewName=`echo $n | tr -s " " "_"`
echo $NewName
mv "$OldName" "$NewName"

[ Reply to This | # ]
Run this script anywhere?
Authored by: osxpounder on May 20, '03 02:36:14PM

I'd love to use this, but first I must clear up a more basic mystery [to me; I bet most of you know this]: how can I make it so that my script will run even if I'm not the folder that has the script? There is a way to define a "path" or two in *nix, as in DOS, but I don't know how it's done in *nix or OSX. Can some one point me to a hint for that?

And would that path issue explain why I can't get man pages? I always get "man page not found".


[ Reply to This | # ]
What does the first line mean?
Authored by: osxpounder on May 20, '03 02:38:40PM

By the way, what does the line beginning with "#! ..." mean?

It is a comment, right? I.e., it doesn't do anything, right? If that's the case, why the "!" ... what is this line supposed to be telling us?


[ Reply to This | # ]