May 14, 2003 #1 dvknn IS-IT--Management Joined Mar 11, 2003 Messages 94 Location US I need to find the latest file in the directory. The files in the script are in: 12n%m%d.%y. I need to find the latest file. I can do it if I execute ls 12n*.03 I want to replace the '03' with %y'. How can I do that? Thanks.
I need to find the latest file in the directory. The files in the script are in: 12n%m%d.%y. I need to find the latest file. I can do it if I execute ls 12n*.03 I want to replace the '03' with %y'. How can I do that? Thanks.
May 14, 2003 #2 gamerland Programmer Joined Apr 6, 2003 Messages 53 Location US lYEAR=`date '+%yy'` lFILENAME="12n*."$lYEAR ls $lFILENAME However, if you are looking for the last file touched: ls -ctrl directoryname | tail -1 Upvote 0 Downvote
lYEAR=`date '+%yy'` lFILENAME="12n*."$lYEAR ls $lFILENAME However, if you are looking for the last file touched: ls -ctrl directoryname | tail -1