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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.