Re: [SLUG] A little off topic

From: Jim Wildman (jim@rossberry.com)
Date: Thu Jul 11 2002 - 10:34:44 EDT


Something like
for i in `find . -type f`
do
        $NEW=`echo $i | tr ' ' ''`
        mv $i $NEW
done

might work. May be tricky getting the right input to tr.

------------------------------------------------------------------------
Jim Wildman, CISSP jim@rossberry.com
http://www.rossberry.com

On Thu, 11 Jul 2002, Carson Wilcox wrote:

> I need to remove the spaces from all the file names in a directory.
>
> The command:
> find -type f | tr ' ' '-'
>
> Replaces all the spaces with a '-' and prints it to stdout,
> however I can't figure out how to actually rename the file.
>
> I thought that
> find -type f | tr ' ' '-' | xargs cp
>
> might work, but that barfed all over it self, any ideas
> appreciated.
>
> Thanks,
> Carson
>



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 13:39:03 EDT