Funny. I wrote a script that does that, but recursively for all subdirs too.
Here's a good place to start: File::Find


> -----Original Message-----
> From: Sudarshan Raghavan [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 25, 2002 8:56 AM
> To: Perl beginners
> Subject: re: directory scanning
> 
> 
> On Thu, 25 Jul 2002, William Black wrote:
> 
> > Hi All,
> > 
> > I need an idea on how to approach a script.  Say I had a 
> directory X with 50 
> > files in it and I have another directory Y that is suppose 
> to have the same 
> > exact files in it as X.  How could someone approach 
> checking directory Y 
> > aginst X to see if they had the same files?
> 
> By the same file if you mean same contents, check out File::Compare
> The approach would be something like this.
> 
> use File::Compare;
> opendir (DIRX, $dirX) or die ".....";
> while (my $xfile = readdir(DIRX)) {
>   if (compare($xfile, "$dirY/$xfile") != 0) {
>     print "Your error messages";
>   }
> }
> closedir (DIRX);
> 
> Note, you will have to add a check to see if the number of 
> files in dir X 
> and dir Y are the same.
> 
> > 
> > Thks,
> > 
> > 
> > William Black
> > 
> > 
> > 
> > _________________________________________________________________
> > MSN Photos is the easiest way to share and print your photos: 
> > http://photos.msn.com/support/worldwide.aspx
> > 
> > 
> > 
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

----------------------------------------------------------------------------
--------------------
The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to