|
getting the most recent file
Hi,
I have files coming in every day with that days timestamp like:
nameyyyymmddhhmmss.ext.
I need the most recent one and so i am using
cat `ls -t name*|head -1 ` > temp
i am sorting the files in the decending order and am copying the most recent one into a temp file.
It works at times but sometimes it does not.
Is there a better way to do it?
I dont want to compare it to todays absolute date ;I just want the most recent file.
any suggestions will be appreciated.
thanks
|