Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Renaming Directories Recursively

by synapse0 (Pilgrim)
on Jul 22, 2001 at 01:19 UTC ( #98702=note: print w/replies, xml ) Need Help??


in reply to Renaming Directories Recursively

recursive loop...

<psuedo-code>
sub rename_dir { $curdir = shift; opendir($curdir) foreach $dir(readdir($curdir)) { next unless $dir is directory; &rename_dir($dir); # recurse rename($dir); } closedir(current dir) }
</psuedo-code>
something to that effect should work, i can't create a test run here, but i think the basics should be in that example..
basically this follows the dir tree to the end, and then rename directories as it comes out of the loop.
-Syn0

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://98702]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2023-01-27 01:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?