[wellylug] Blank in file names ?

David Antliff dave.antliff at paradise.net.nz
Fri Apr 23 23:05:27 NZST 2004


On Fri, 23 Apr 2004, Chris Targett wrote:
> Debian.. if your using debian.. has a tool called rename, but its
> different in gentoo so I can't provide any accurate working examples,
> but i think its: rename * 's/ /_/'

Yes, in Debian it's a perl script that takes a perl experssion and a list
of files to rename. E.g:

$ rename 's/\ /_/g' *

The perl script (cat `which rename`) makes interesting reading if you want
to know how it works.

In Gentoo it's different:

Syntax: rename <pattern1> <pattern2> <files...>

This changes all occurances of pattern1 into pattern2 for all files
specified. E.g (not tested):

$ rename ' ' '_' *

$ rename .tar.gz .tgz *   # renames all *.tar.gz files to *.tgz

I've never found the Gentoo program quite as flexible as the Debian one,
but it has its uses.

-- 
David.





More information about the wellylug mailing list