[Gllug] Poor scripting?!

Henrik Morsing henrik at morsing.cc
Wed Mar 12 07:51:22 UTC 2008


On Tue, Mar 11, 2008 at 03:36:27PM +0000, John Edwards wrote:
> 
> Is there any reason you aren't using Perl's own rename program?
> 
> find . -iname "*pattern*" -print0 | xargs -r0 rename 's/pattern/replacement/g'
> 
> Of course you may have too many directories for rename to process as
> arguments. It certain works with several thousand.

Well, just looked at this and a couple of reasons, one  being that I don't seem to have that rename program :)  The other is that with this option I'd have to run find twice (for the two different patterns) and running find seems to be what takes time.

If I run my dedicated Perl script it only needs to run find once which takes less than 2 minutes.

I counted the directories btw and out of 3300 directories it will typically change about 60 of them.

Regards
Henrik Morsing
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list