On Sun, Jul 27, 2003 at 12:45:26PM +0300, Micha Feigin wrote:
> I am trying to do a batch rename for a bunch of files with spaces in the
> name (in order to remove the spaces actually). I tried to use bash's for
> .. in command but it splits up the lines on spaces and not on line ends.
> Any ideas?
> 
> The files are named "Copy of ..." and I want to drop the Copy of part.
> I tried to do
> for file in `ls -1`; do 
>   cp $file `echo -n "$file" | sed 's/Copy of \(.*\)/\1/'`
> done

Assuming you're using bash:

for f in *; do 
   cp "$f" "${f/Copy of /}"
done


-- 
Dave Carrigan
Seattle, WA, USA
[EMAIL PROTECTED] | http://www.rudedog.org/ | ICQ:161669680
UNIX-Apache-Perl-Linux-Firewalls-LDAP-C-C++-DNS-PalmOS-PostgreSQL-MySQL

Dave is currently listening to Tom Petty And The Heartbreakers - Jammin' Me (Let Me Up 
(I've Had Enough))


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to