Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #2
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    2,945
    Thanks
    2
    Thanked 170 Times in 165 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •