[PLUG] Mass Removal of White Space in File Names

Rich Shepard rshepard at appl-ecosys.com
Mon Apr 18 13:14:28 UTC 2011


On Sun, 17 Apr 2011, Rogan Creswick wrote:

> There is as perl script called 'rename' that makes this very easy:
>
> $ rename 's/ //g' Some\ File\ Name.ext

Rogan,

   There's no 'prename' here, but there is /usr/bin/rename as part of the
util-linux-ng package. The man page does not suggest the flexibility to use
sed to eliminate spaces or replace them with underscores.

> Will take the spaces out (destructively, so be careful.  I don't know how
> it handles filename conflicts that may arise, I suspect not gracefully.). 
> Combined with find and xargs, you can apply it to a whole directory tree
> (I haven't tested the following line though, so beware of typos/etc..):

   If there are no filename conflicts with spaces how could there be filename
conflicts without them? Just curios.

> There are also probably other programs called rename.  This is what I
> get if I run 'rename' with no arguments:

   Here, it's:

[rshepard at salmo ~]$ rename
call: rename from to files...

Thanks,

Rich



More information about the PLUG mailing list