Re: OT: shell scripts and spaces in file/folder names
Thank you all for you're replies - I hadn't thought
about the possibility the '*' would work better than
the '.' ... though now I know, I can see some logic in
it.
I now wrote a very small script which will convert
every space in the name into a '-'
----
#!/bin/sh
for i in *
do
#echo "mv \""$i"\" `echo "$i" |sed -e 's/\ /-/' -
`"
mv "$i" `echo ` "$i" | sed -e 's/\ /-/' - `
done
---
I post to be sure, can you assure me my quickly
written script can't do any harm - I'm not really used
to the sed command...
again, thank you :-)
Joris
--- Alvin Oga <aoga@Maggie.Linux-Consulting.com>
wrote:
>
>
> On Thu, 17 Apr 2003, Joris Huizer wrote:
>
> > for i in `ls .`
> > do
> > #...
> > done
>
> try ... (untested )
>
> #
> # note star instead of dot ...important...
> #
> # dont forget to cd /someplace/first
> # and make sure cd worked
> #
> for i in ` ls * `
> do
> ls -la ' $i '
> done
>
> what you do with the files w/ whitespaces and other
> whacky chars
> is up to you ... iny our command to process those
> files
> --
> -- be careful .. you can get into a heap of trouble
> -- w/o first checking the files for
> wierd/un-acceptable filenames
> -- esp if you have a joker in your lan that likes
> practical jokes
> --
>
> -- scripting is fun and annoying too, and fast and
> simple, or long and
> tedious
>
> c ya
> alvin
>
__________________________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo
http://search.yahoo.com
Reply to: