How do I Parse a file share

Matthew Diephouse matt at diephouse.com
Tue Dec 23 17:45:56 CST 2003


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
>
>           
>              
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 4062 bytes
Desc: not available
Url : http://mail.pm.org/archives/grand-rapids-pm-list/attachments/20031223/9ef72af1/attachment.bin


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