in reply to Re^5: dir handle
in thread dir handle
system : windows 7
i search for file::tiny in ppm but not found
my logic:
open both dir and take list of filename in array so one contain 2 and other 3 then in for loop i run index of array to capture individual file and apply copy() from File::Copy but when i m using $test1$x one dir contain one less file so i got an err so my copy statement not executed.. please help....use strict; use warnings; use File::Copy; my @test1; my @test2; print "Enter the file path form where you want to copy file:\n"; chomp(my $path1 = <STDIN>); opendir DH, "$path1" || die "$!"; @test1 = readdir (DH); print "@test1\n"; print "Enter the file path form where you want to copy file:\n"; chomp(my $path2 = <STDIN>); opendir DH, "$path2" || die "$!"; @test2 = readdir (DH); print "@test2\n"; my $count = @test1; my $count2 = @test2; my $x = 0; for ($x = 0; $x<$count2; $x++) { if($test1[$x] ne $test2[$x]) { print "$test1[$x] : $test2[$x]\n"; # copy("$test1[$x]", "$path2") or warn "cannot copy $test1[$x]" +; # copy("$test2[$x]", "$path1")or warn "cannot copy $test2[$x]"; +; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: dir handle
by RichardK (Parson) on May 27, 2014 at 12:25 UTC | |
|
Re^7: dir handle
by ww (Archbishop) on May 28, 2014 at 01:57 UTC |