[PLUG] Mass Removal of White Space in File Names

Robert Citek robert.citek at gmail.com
Mon Apr 18 04:51:38 UTC 2011


On Sun, Apr 17, 2011 at 10:27 PM, Michael Rasmussen <michael at jamhome.us> wrote:
>    however the syntax to work with that is find ... -print0 | xargs -0 which then uses NULL as the file name delimiter
>    so:  find <path> -type f -print0 | xargs -0 rename 's/ /_/g'

That would seem to work:

$ find -type f
./bar/g h.txt
./bar/e f.txt
./foo/a b.txt
./foo/c d.txt

$ find . -type f -print0 | xargs -0 rename 's/ //g'

$ find -type f
./bar/gh.txt
./bar/ef.txt
./foo/ab.txt
./foo/cd.txt

$ lsb_release -d
Description:	Ubuntu 10.04.2 LTS

Good luck and let us know what works for you.

Regards,
- Robert



More information about the PLUG mailing list