Renaming files in one shot

Matthias Apitz m.apitz at oclcpica.org
Fri Jan 26 14:12:55 UTC 2007


El día Friday, January 26, 2007 a las 02:36:03PM +0100, Vittorio escribió:

> Under a directory I have many pdf files named according to M$ Windows 
> rules, that is:
> 
> Marylin Monroe.pdf
> James Stewart.pdf
> Alice in 
> Wonderland.pdf
> Ludwig Van Beethoven.pdf
> .....
> .....
> 
> Now I'd like to 
> rename them ** IN ONE SHOT ** (some more steps would be acceptable 
> anyway!) deleting all the blanks, that is
> 
> MarylinMonroe.pdf
> JamesStewart.pdf
> AliceinWonderland.pdf
> LudwigVanBeethoven.pdf
> ........
> ........
> 
> How can I do that?

with something like:

$ for i in *.pdf ; do mv "$i" `echo "$i" | sed 's/ //g'` ; done

(make a backup before :-))

	matthias
-- 
Matthias Apitz
Manager Technical Support - OCLC PICA GmbH
Gruenwalder Weg 28g - 82041 Oberhaching - Germany
t +49-89-61308 351 - f +49-89-61308 399 - m +49-170-4527211
e <m.apitz at oclcpica.org> - w http://www.oclcpica.org/ http://guru.UnixLand.de/
b http://gurucubano.blogspot.com/


More information about the freebsd-questions mailing list