Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
laziness, impatience, and hubris
 
PerlMonks  

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

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

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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."

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

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 07: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 07: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
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.