recursion - Using Perl, how can I rename files in all subdirectories of a drive? -
itemprop = "text">
I can rename all the files on the drive with the .wma and .wmv extensions. In directory structure?
The examples given in the documentation are very self-explanatory and you will find most of the methods there. When you have an attempt, update the question with more information.
If this is a learning curve, then you will learn better before trying to do yourself.
Update:
Assuming that you have to do this and have a chance to keep in mind that various solutions were posted I am posting how I could have done this. Note that I choose to ignore files like ".wmv": My regeses need to come before the dot.
#! Use / usr / bin / perl strict; Use warnings; File :: Use Search; Mine ($ dir) = @ARGV; Find (& amp; mc, $ dir); The Deputy wanted {until the return -f; Unless that / ^ (. +) \ .wm [av] $ / i; My $ new = "$ 1.txt"; Rename $ _ = & gt; $ New or alert "'$ _' = & gt; '$ new' failed: $! \ N"; Return; } __END__
Comments
Post a Comment