How do I Parse a file share

Matthew R. Heusser HEUSSERM at student.gvsu.edu
Sun Dec 28 19:13:43 CST 2003


Kyle:

If you get it to work, or even if you get stuck, this sounds like the makings of a Great Presentation for GR.PM.  If you get it work, it could be "Look at the power of File::Find."  If you get stuck, you could present "I did this and this; here is how these modules work, this is what I implemented, what should I do next?"

While we can't offer you cash (sorry), we can offer you a free lunch and a O'Reilly Technical book of your choice.  And we have a big pile of books.  Just give it some thought ...

regards,

Matt Heusser


-----Original Message-----
From: Kyle Victor <kvictor at reidtool.com>
To: "'Matthew Diephouse'" <matt at diephouse.com>
Date: Wed, 24 Dec 2003 09:29:09 -0500
Subject: RE: How do I Parse a file share

Matt
 
first thank you...I had thought about running the script local to the
machine and now that you say that that is the best option I will be that
 
to answer your questions...its a Win2K server that holds the volume, and I
use a Win2K client...so your assumption is not correct, but we do have 4
Linux server, 1 a RedHat Advance Server I just implemented...but I am a MCSE
(or storm trooper in the imperial army as like to call myself)...anyway....I
will take a look at File::Finder and File::Find::Rule modules but I will
take your advise and as a first step will run the Perl local....
 
thank you 
Kyle

-----Original Message-----
From: Matthew Diephouse [mailto:matt at diephouse.com] 
Sent: Tuesday, December 23, 2003 6:46 PM
To: Kyle Victor
Cc: 'grand-rapids-pm-list at happyfunball.pm.org'
Subject: Re: How do I Parse a file share



Kyle, 


What types of machines are you running? Are you using samba? I'm assuming
you're using samba with a windows server and a linux client. The more linux
is involved, the easier this will be. 


The best option would be to run the perl right on the server. That will be
cleanest and the least amount of work. 


Otherwise, you can try to mount the samba share on your client, using
smbmount, and use File::Find with that. The little googling I did leads me
to believe that there may be a few problems with this solution, but I'd
investigate it. 


Else you can write your own solution using Filesys::SmbClient You'd
basically need to write code to recurse the directories and use stat. You
might even be able to take a copy of File::Find and change all the calls so
they are methods on a Filesys::SmbClient object. 


You may also like a look at File::Finder and File::Find::Rule, which are two
recent modules that supposedly boast a cleaner interface than File::Find.
They might both just be wrappers to File::Find, I'm not sure. 


Hope this helps, 


matt diephouse 

---------------------- 

http://matt.diephouse.com 


On Dec 23, 2003, at 11:52 AM, Kyle Victor wrote: 


First here is my code: 


#!/usr/bin/perl -w 

use strict; 

use File::Find; 


my $days = 365; 

my $path = '/'; 


print find(sub {(-A) > $days && print $File::Find::name,"\n";}, $path); 

exit; 


This will let me look thru my HD for files that have not been or have been
accessed inside/outside of a given # of days 


Now I want to be able to look at a file share (one of the volumes on a
server) and do the same as what the above code does 


I have a 235 G volume that is down to 5 G and my users say its all good data


I want to parse it and find files that have not been accesses in say the
last 14 months 

Then move them and archive to DVD 

But for now just need to print 


I am a newbie for sure...but have some C++ and VB so I have taken to Perl
thus far... 

but have had a problem finding help on parsing a file share... 


Can or will ya'll help 


thanks 


Kyle Victor  MCSA/MCSE/CCNA 

Network Administrator 

MIS Department of Reid Entities 

2265 Black Creek Road 

Muskegon, MI 49444 

Phone: 231.767.3772 


           

              



Matthew Heusser,
heusserm at student.gvsu.edu



More information about the grand-rapids-pm-list mailing list