Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Rename multiple files following their directories' name

by choroba (Chancellor)
on Mar 19, 2013 at 11:36 UTC ( #1024274=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    for folder in folder* ; do
        [ -f $folder/abc.txt ] && mv $folder/abc.txt $folder/$folder.txt
    done
    
  2. or download this
    for my $folder (glob 'folder*') { # or (grep -d, glob 'folder*')
        rename "$folder/abc.txt", "$folder/$folder.txt" if -f "$folder/abc
    +.txt";
    }
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (12)
As of 2016-09-30 17:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (571 votes). Check out past polls.