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

Re: mv files from dir1 to dir2

by gasho (Beadle)
on Jan 12, 2009 at 18:40 UTC ( [id://735762]=note: print w/replies, xml ) Need Help??


in reply to mv files from dir1 to dir2

Maybe This will help
use File::Find::Rule; sub fullPathToFile #($StartDirectory,$SearchExpression) { my ($StartDirectory,$SearchExpression)= @_; my(@files,$IsWin1,$IsWin2,$IsWin3,@File_Paths,$Fl,@d,$c); @files = File::Find::Rule->file()->name("$SearchExpression")->in(" +$StartDirectory"); $IsWin1=substr($StartDirectory,1,1); $IsWin2=substr($StartDirectory,0,2); $IsWin3=substr($StartDirectory,0,1); print "HO HO:$IsWin3\n"; #If $StartDirectory starts with "D:\" or "\\\\" or" \" than it +is Win replace / with \ if( ($IsWin1 eq ':')||($IsWin2 eq '\\\\') ||($IsWin3 eq '\\') + ) { foreach $Fl (@files) { @d=split(/\//,$Fl); $c=join ("\\",@d); push(@File_Paths,$c); } } else { @File_Paths=@files; } return @File_Paths; } $LocationOfTheScriptsDirectory='/Harness/RootOfAllFiles'; $newdir='/TEST'; $SearchExp='*.abl'; @AllFilePaths=fullPathToFile($LocationOfTheScriptsDirectory,$SearchExp +); foreach $file (@AllFilePaths){ @A2 =split(/\//,$file); $fileName=$A2[-1]; system( "cp $file $newdir/$fileName"); }
(: Life is short enjoy it :)

Replies are listed 'Best First'.
Re^2: mv files from dir1 to dir2
by lomSpace (Scribe) on Jan 12, 2009 at 19:42 UTC
    Not clear what this is supposed to do?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-04-25 13:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found