Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^3: Copying files from one directory to another with different subdir

by Corion (Patriarch)
on Sep 19, 2016 at 12:50 UTC ( [id://1172128]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Copying files from one directory to another with different subdir
in thread Copying files from one directory to another with different subdir

Maybe you can show some examples of what you have as source directory structure and target directory structure and how both source and target are specified. Then we can better advise you on the approach to take.

  • Comment on Re^3: Copying files from one directory to another with different subdir

Replies are listed 'Best First'.
Re^4: Copying files from one directory to another with different subdir
by PiyaPerl (Acolyte) on Sep 19, 2016 at 12:59 UTC
    sure... so the source directory is like :
    /proj/tool/STAGE/<ENV>/<CLIENT>/*.xml and the target dir is like:
    /proj/tool/PROD/<ENV>/<CLIENT> Where in both cases the <ENV> can be something like: Env A,Env B and so on and Client can be Client A and Client B and so on. but ideally the script should be able to copy files from source to target. something like :
    cp /proj/tool/STAGE/EnvA/ClientA/*.xml /proj/tool/PROD/EnvA/ClientA
    cp /proj/tool/STAGE/EnvA/ClientB/*.xml /proj/tool/PROD/EnvA/ClientB
    cp /proj/tool/STAGE/EnvB/ClientC/*.xml /proj/tool/PROD/EnvB/ClientC
    Let me know if more information is needed.

      In which part would, for example, File::Copy::Recursive fail? Just call it for (say) /proj/tool/STAGE/EnvA/ClientA/ to /proj/tool/PROD/EnvA/ClientA/ and so on.

      Also see glob and readdir, where glob is the much better approach.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2024-04-24 07:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found