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 dofor file in `ls -1`; do cp $file `echo -n "$file" | sed 's/Copy of \(.*\)/\1/'`done but like I said the file name is split into three matches, one for "Copy", one for "of" and one for the rest (no more spaces). For the moment I am ignoring the option for other files in the directory since that is much easier to handle. Thanks
install mmv and then you can do 'mcp "Copy of *" "#1"'. Otherwise: for file in *; do cp "$file" `echo -n "$file" | sed 's/Copy of \(.*\)/\1/'` done should work...
Attachment:
pgpENggEyzScW.pgp
Description: PGP signature