Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Find the array containing string and copy the file to other folder exactly

by SubaRavi (Initiate)
on Apr 05, 2019 at 06:19 UTC ( #1232173=CUFP: print w/replies, xml ) Need Help??

Find the array containing string and copy the file to other folder extactly

use strict; use warnings; use File::Copy; use File::Find::Rule; use File::Find; use File::Basename; my $source_dir = "<Sorce Directory with specific files>"; my @doc=File::Find::Rule->file->name('*.xml')->in($source_dir); my $path="<parent folder>"; my @folders; find sub{ push @folders, "$File::Find::name" if (-d $File::Find::name); },$path; foreach my $fileformat (@doc){ my $baseFile=basename ($fileformat); $baseFile=~s/\.xml//isg;###handled xml for sake my @results = grep /$baseFile/, @folders; copy ($fileformat,@results); ###copied files to destination and ma +tched }
  • Comment on Find the array containing string and copy the file to other folder exactly
  • Download Code

Replies are listed 'Best First'.
Re: Find the array containing string and copy the file to other folder extactly
by davido (Cardinal) on Apr 05, 2019 at 06:47 UTC

    Please let us know what your question is so that we can try to lend assistance. Stating the design requirement isn't a question. Ask about the part you are having trouble with.


    Dave

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2020-06-02 06:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?



    Results (13 votes). Check out past polls.

    Notices?