Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Use File::Find and stat - Re: maintain control over very many files

by metadoktor (Hermit)
on Feb 25, 2002 at 12:18 UTC ( [id://147317]=note: print w/replies, xml ) Need Help??


in reply to maintain control over very many files

You can use File::Find to traverse the specific directory that you want to look at and stat each file for the modify time as you process it using File::Find.

As for keeping track of new files you can always save the previous directory contents and compare them to whatever is in there now. If your list of files is truly huge then you may have to employ special tricks to optimize your compares.

metadoktor

"The doktor is in."

Replies are listed 'Best First'.
Re: Use File::Find and stat - Re: maintain control over very many files
by clemburg (Curate) on Feb 25, 2002 at 12:24 UTC

    No, you don't want to go that way. There are tools out there (see above) that can do it all for you. Why reinvent the wheel for the nth time.

    Christian Lemburg
    Brainbench MVP for Perl
    http://www.brainbench.com

Re: Use File::Find and stat - Re: maintain control over very many files
by Sinister (Friar) on Feb 26, 2002 at 12:10 UTC
    _IF_ you want to do such, you will have to remember of each file, what the last modifytime was - where are you going to store this?

    The trick is (that is _IF_ you _REALLY_ want this) to touch a .time file (or some other hidden file) when your done with that dir, and then process the next. This way all newer then .time is newer... (if . is <= .time you don't even have to look in that dir...)

    Sinister greetings.
    "With tying hashes you can do everything God and Larry have forbidden" -- Johan Vromans - YAPC::Europe 2001
    perldoc -q $_

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (2)
As of 2024-03-19 06:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found