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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading Filenames into an Array

Status
Not open for further replies.

palcrypt

Programmer
Dec 20, 2004
3
US
It has been a while sine I last used Perl. So I'm a little rusty. What I want to do is write a script that will read the names of all the files in a folder into an array and sort them by they're date modified property. Any help would be greatly appreciated.

Thanks.
 
Take a look at the documentation for opendir and readdir. These functions will do everything you're looking for.

- Rieekan
 
As far as I can find readdir will let you read the names of a file into an array, but it doesn't sort them at all. I think I can right a script using readdir I just need to know how to access a files date modified or date created property.

--paul
 
Take a look at the stat function. The 10th field should be what you're looking for - the modification time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top