how to rename 200 files in many sub-directories?

G

Geoff Cox

Sure, it's not that complicated. :)

Many thanks John - very helpful.

You might like to know that I gave this assistance of yourself and the
others as an example of the better side to the Internet, tonight, at a
talk I gave at our local Computer Club!

Cheers

Geoff
$_ contains the name of the current file which is assigned to $name. A
substitution is performed on $name and if it ends with the four
characters '.zip' (or '.ZIP' or '.Zip', etc.) they are replaced with the
four characters '.doc'. If the substitution was not successful (the
file name didn't end in '.zip') return from the sub. If successful $_
will contain 'somefile.zip' and $name will contain 'somefile.doc'.


Create an Archive::Zip object using the file name in $_.

$zip->extractMember( ($zip->memberNames)[ 0 ], $name );

Use $zip->memberNames to get the first file name from the zip archive
and use $zip->extractMember to store the contents of that file using the
file name in $name.


Delete (unlink) the file $_ or complain if you can't.


Use the directory name in $dir as the starting point in the search.



John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
DewittMill
Top