Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need to print list of modified file 1

Status
Not open for further replies.

nuarj83

Programmer
Aug 30, 2006
6
US
Hi,
Can any one give me an idea of "how to print only the modified files with in last 24 hours with atime and mtime" in perl & folder contains sub folder and sub-files.

The issue is the enivoronment is WIN32.

Any help is appreciated.
Thx.
 
The environment shouldn't matter... stat() tends to return the same results regardless.

Make a recursive directory scanning subroutine (one that will call itself again recursively for each folder it finds within a folder and so-on) to get a list of the paths to every file, and then call stat on the files to do with them whatever you want.
 
Thank you for your quick response.

fine , i have done the same but can you give me the logic(or any loop kind of thing) of printing the only files that have changed within last 24 hours.

Thx
 
Code:
use File::Find;
my $dir = '/path/to/dir';
find( sub {print "$_ \n" if (-M) < 1},$dir );
 
Thank you, every one for such a valuable post. Really it was a great help.

Thx.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top