File sorting

Just starting out? Need help? Post your questions and find answers here.
dannyboy99
User
User
Posts: 27
Joined: Sun Jul 13, 2008 9:47 am
Location: UK

File sorting

Post by dannyboy99 »

I need to write a simple bit of code, so that I can put a gadget box up with the date of the oldest file in a backup directory.

I can examine the directory, but cannot work out how to continue.

Any ideas please
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Post by pdwyer »

if you need to actually sort then load to an array and use the sortarray the get the last element.

or if you just need the oldest date, as you loop through them, keep the currentoldest in memory and compare, if older than currentoldest then currentoldest = currentfile
Paul Dwyer

“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
dannyboy99
User
User
Posts: 27
Joined: Sun Jul 13, 2008 9:47 am
Location: UK

Update

Post by dannyboy99 »

I just need a small bit of code to tell the users via a gadget box, the date of the oldest file in the backup directory so they will know when the files were last moved into a removal hd
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Post by pdwyer »

Paul Dwyer

“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
TerryHough
Enthusiast
Enthusiast
Posts: 781
Joined: Fri Apr 25, 2003 6:51 pm
Location: NC, USA
Contact:

Post by TerryHough »

I suggest reading this post.
http://www.purebasic.fr/english/viewtopic.php?t=33900

There should be an idea there you can use.
Post Reply