Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Folder compare problem for Windows

Status
Not open for further replies.

tofumanTT

MIS
Joined
Nov 28, 2006
Messages
4
Location
US
I have spent a lot of time and finally installed and made folder copy successfully,
from the source data folder (to_be_copied) on C:
to a target folder (Coped_to) on a network drive (for instance Z:).

However, I need to do folder comparison between these two folders to make sure the data are consistent without file corruption.
I found online states that File:Dircmp is PASS and good to use. I installed it successfully on my Windows 2003 server and a Windows XP.
I copied 62 files in the datafolder from C: to Z: Thereafter,
I found that even I delete 2 files in the target folder (made 60 files left) on Z: before comparing, the File_Dircmp module still reports 62 files and no error!

The Perl code is:
-----------------------------------------------------------
use File::Copy::Recursive qw(fcopy rcopy dircopy fmove rmove dirmove);

my $dataSource = "datafolder";
$locomp = Win32::NodeName(); #need to modify in Linux-Mac
my $dataDestin = @ARGV[0].":/"."_".$locomp."_WRITE";
my $diff=1;
my $suppress=1;

my $num_of_files_and_dirs = dircopy($dataSource,$dataDestin) || die "fail to copy";

print "falling sleep\n";
sleep 30; #during this 30 seconds for deleting 2 files in the target folder on Z:
print "woke up\n";

use File:Dircmp; #run folder compare similar to "diff /b ...." in Linux
my @r = dircmp($dataDestin, $dataSource, $diff, $suppress) || die "fail to compare";
foreach (@r) {
print $_." files had been compared\n";
}
---------------------------------------------------------
Question:
1. Why in Linux, many online articles shown a lot of decent reports automatically generated by 'dircmp'; but in Windows there is none or not even echo in DOS command line?
2. When I use $suppress=1, at line 34 -->my @r = dircmp (.................; will fail to run.
==>Perl reported error: "fail to compare at copyfolder-fc.pl line 34".

3. When I use $suppress=0, starts to run the command line; after Perl reports 'falling sleep', deleted 2 files in the target folder on Z: ; after Perl reports 'woke up', it reports no error at all, period!

The command line and result:
---------------------------------------
==>perl copyfolder-fc.pl z
falling sleep
woke up
62 files had been compared.
---------------------------------------
Obviously 'dircmp' failed to do what it supposed to do in Windows!

What is going on?
What is wrong with it?

Please HELP!!!!!!!!!!!!!
Thanks in advanced.
 
Thanks for your prompt response.

Oh boy, it is very discouraged that File-Dircmp does not run $diff properly for Windows. I am hoping the author Josh will do something about it.
 
Hi KevinADC,

I could not find File-DirCompare module in the Active Repositories list so that I cannot install this module.

The Perl script for using File:DirCompare does not work without it.

If you have any better idea how to get this module to install, then I can try to use it. Thanks.
 
I decided not to use File-Dircmp because the author is too busy to help. I finally worked out with diff.exe to accomplish the fc. It's good enough.

Thanks a lot KevinADC. You are very nice and willing to help others.

I still short of "deleting folder" module for Perl but it is not in this scope. I should create a new subject title later.
 
You're welcome, glad to see you found a solution. [smile]

- Kevin, perl coder unexceptional!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top