in reply to How do I emulate DOS XCOPY command under Perl for Windows
Lately I find myself using File::Find more and more often...
Here this schould help you...
#Used to recurse through directories and files use File::Find; #Used to copy directory strucutre of "USERS" use File::Path; #Used to copy each file to its directory use File::Copy; #No trailing slash on any of the following #Specify directory to copy $old_dir = '/site/users'; #Specify directory to backup to $new_dir = '/backup/users'; print "Copy Directory structure of $old_dir - "; mkpath([$old_dir, $new_dir], 1, 0777) || die "\n\tCouldn't copy $old_d +ir '$!'"; print "Successful\n"; print "Copying files to new directory -\n"; find(\&each_file,"$old_dir/") || die "\n\tCouldn't copy files '$!'"; print "Succssful\n"; sub each_file{ my $FilePath = $File::Find::name; #Specified comlete location to fi +le #Location to move to my $MovePath = $FilePath; $MovePath=~s/\Q$old_dir\E/\Q$new_dir\E/i; #Do this so it doesn't in +terpret "dir" vairables as regexp print "Copying file $_ - "; copy($FilePath,$MovePath); print "Successful\n"; }
"The pajamas do not like to eat large carnivore toasters."
In German: "Die Pyjamas mögen nicht große Tiertoaster essen.
In Spanish: "Los pijamas no tienen gusto de comer las tostadoras grandes del carnÃvoro."
|
|---|