habhab has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use File::Find; use File::Copy; use Cwd; my $Src = $ARGV[0]; my $Trg = $ARGV[1]; my $path = getcwd(); find (\&wanted, $Src); sub wanted { opendir (DIR, "$path/$Trg") or die "cannot opendir $Trg"; foreach my $file (readdir(DIR)) { if ($_ == $file) { print "File already in $Trg: $file\n"; } else { copy("$_","$path/$Trg/$_"); } } closedir (DIR); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: How can I compare two directories and copy over files missing from one to another?
by merlyn (Sage) on Sep 18, 2004 at 00:12 UTC | |
by DrHyde (Prior) on Sep 20, 2004 at 08:13 UTC | |
|
Re: How can I compare two directories and copy over files missing from one to another?
by JediWizard (Deacon) on Sep 17, 2004 at 19:16 UTC | |
|
Re: How can I compare two directories and copy over files missing from one to another?
by TheEnigma (Pilgrim) on Sep 17, 2004 at 19:27 UTC | |
by habhab (Acolyte) on Sep 17, 2004 at 20:58 UTC | |
|
Re: How can I compare two directories and copy over files missing from one to another?
by paulbort (Hermit) on Sep 17, 2004 at 21:31 UTC | |
|
Re: How can I compare two directories and copy over files missing from one to another?
by steves (Curate) on Sep 18, 2004 at 15:40 UTC |