Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comparing the same directory on two different machines Win32

by RayRay459 (Pilgrim)
on Feb 07, 2002 at 17:58 UTC ( [id://143941]=perlquestion: print w/replies, xml ) Need Help??

RayRay459 has asked for the wisdom of the Perl Monks concerning the following question:

Fellow Monks, i am in need of your guidance.
I am not sure how i want to go about this. I want to write a script that will look at a directory on one machine and use that as a template to compare files on another. (size, mod time, permissions)
I've created a script..pretty much from examples of the modules for individual files:
use Win32::FileSecurity; use File::stat qw(:FIELDS); print "enter in a file to get info on: "; chomp($InFile = <STDIN>); if (Win32::FileSecurity::Get($InFile, \%Perms)) { print "Permissions for $InFile:\n"; foreach $Account (sort( keys( %Perms))) { print "\t$Account:\n"; if (Win32::FileSecurity::EnumerateRights( $Perms{$Account}, \@ +List)) { map {print "\t$_\n";} (@List); } else { print "\t\tNone\n"; } } } else { print "Error accessing permissions for $InFile:\n"; print "Win32::FormatMessage( Win32::GetLastError() )"; } $stat = stat($InFile) or die "No File :$!"; if ($st_size & $st_mtime) { print "\n" . $st_size; print "\n" . $st_mtime; }

Should i use "readdir" to create an array of files and check each one individually on each machine? Or maybe a hash of files with their size, modtime and permissions? Eitherway, i'm not too sure how to really get this done. Can anyone please help. Your advice would be much appreciated.
your fellow monk
Ray

Replies are listed 'Best First'.
Re: comparing the same directory on two different machines Win32
by Moonie (Friar) on Feb 07, 2002 at 22:13 UTC
Re: comparing the same directory on two different machines Win32
by perrin (Chancellor) on Feb 07, 2002 at 19:58 UTC
    I'd suggest either using rsync (it runs fine on the cygwin tools) or stealing code from File::Compare.

Log In?
Username:
Password:

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

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

    No recent polls found