Go Back   CodingForums.com > :: Server side development > Perl/ CGI

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-30-2013, 07:45 AM   PM User | #1
Maha99
New to the CF scene

 
Join Date: Jan 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Maha99 is an unknown quantity at this point
Sorting the Dates from recently used

Hi,

How to sort the folder to latest date in a package present inside directory.
For Eg:
The package name is wf011213
here,wf is package name,01 is month,12 is date and 13 is year,

Like this there are list of folder names,Need to pick the latest folder from the list.

How shall i do it.Please give an idea.

Thanks in advance,
Maha
Maha99 is offline   Reply With Quote
Old 01-30-2013, 02:59 PM   PM User | #2
FishMonger
Super Moderator


 
Join Date: May 2005
Location: Southern tip of Silicon Valley
Posts: 2,753
Thanks: 2
Thanked 149 Times in 144 Posts
FishMonger will become famous soon enoughFishMonger will become famous soon enough
Parse the filename to extract the date and reorder the numbers to yymmdd format then compare that number with the previous parsed filename keeping the one that is greater.

I assume the folder contains an assortment of packages and you want the latest/newest of each. You'll want to maintain a hash where the keys are the package names (e.g., wf in this case) and the value will be the largest datestamp found for that package.
FishMonger is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:54 PM.


Advertisement
Log in to turn off these ads.