Moving files

Kevin D. Clark kclark at CetaceanNetworks.com
Mon Jan 6 13:44:23 EST 2003


kclark at cetaceannetworks.com (Kevin D. Clark) writes:

> bscott at ntisys.com writes:
>
>>   That could be considered a feature.  Renaming of such directories breaks
>> your code.  Try it.  :-)
>
> Damn.  I thought I tested this too.

OK, this solves this particular problem:

perl -MFile::Find -e 'find({ bydepth => 1,
                             wanted => sub{
                                             $old = $_;
                                             y/ /_/;
                                             rename($old, $_);
                                           }
                           },
                           "kens-mp3-dir")'

The "bydepth" thingie causes the renames to work in the proper order.

Regards,

--kevin
-- 
Kevin D. Clark / Cetacean Networks / Portsmouth, N.H. (USA)
cetaceannetworks.com!kclark (GnuPG ID: B280F24E)
alumni.unh.edu!kdc




More information about the gnhlug-discuss mailing list