[Linux-disciples] Troubles with 'rename'

Adam Rosi-Kessel adam at rosi-kessel.org
Tue Jun 21 16:08:27 EDT 2005


Stephen R Laniel wrote:
> I know that you responded with a script, but it bugs me that
> we'd have to write a script to do recursive directory
> traversal -- that's what 'find' does. We shouldn't have to
> write that again.

Well, my script works. :)

> find . -depth -iname '*\ *' -execdir rename 's/ /_/g' '{}' \;

Hm, I'm not sure you can still guarantee that this will do things in the
right order. It also is going to run rename many more times than
necessary, since it will run it on each file. I can almost guarantee
that my script will be faster than your attempted find command on a
large directory tree.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : http://lists.bostoncoop.net/pipermail/linux-disciples/attachments/20050621/870abedc/signature.pgp


More information about the Linux-disciples mailing list