finding latest file having timestamp on it.....


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting finding latest file having timestamp on it.....
# 1  
Old 08-06-2007
finding latest file having timestamp on it.....

Hi guys,

I have a directory in UNIX having files with the below format, i need to pickup the latest file having recent timestamp embedded on it, then need to rename it to a standard file name.

Below is the file format:

filename_yyyymmdd.csv, i need to pick the latest and move it with the standard file name.

Please help.

regards,

sundar
# 2  
Old 08-06-2007
Don't you think it is useful to tell us what is "standard file name"?

Please, follow the rules, do not duplicate posts:
https://www.unix.com/aix/41219-unix-s...-embedded.html

Last edited by Shell_Life; 08-06-2007 at 11:41 PM.. Reason: Duplicate posts.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Need help with UNIX command to get the latest file from list of files with timestamp

Hi All, I have list of files like below with name abcxyz.timestamp. I need a unix command to pick the latest file from the list of below files. Here in this case the lates file is abcxyz.20190304103200. I have used this unix command "ls abcxyz*|tail -1" but i heard that it is not the appropriate... (2 Replies)
Discussion started by: rakeshp
2 Replies

2. Shell Programming and Scripting

Finding latest file in dir but getting syntax errors

I believe there are couple of syntax issues in my script, couldn't find them :( can someone help me with fixing it to make it work. cd /abcde/ #get the latest filename excluding subdirs filename=`ls -ltr | grep ^- | tail -1 | awk '{print $8}'` #get system date and file timestamp and... (3 Replies)
Discussion started by: simpltyansh
3 Replies

3. Shell Programming and Scripting

Picking the latest file based on a timestamp for a Dynamic file name

Hi , I did the initial search but could not find what I was expecting for. 15606Always_9999999997_20160418.xml 15606Always_9999999998_20160418.xml 15606Always_9999999999_20160418.xml 9819Always_99999999900_20160418.xml 9819Always_99999999911_20160418.xmlAbove is the list of files I... (4 Replies)
Discussion started by: chillblue
4 Replies

4. Shell Programming and Scripting

Search for latest Timestamp in file

Hi, I have a file which generate Timestamp in this format :- 20121012162354 20121114191610 20121210232808 20121216220002 20130106220002 20130127220001 20130203220001 20121012162354 20121114191610 20121210232808 20121216220002 20130106220002 20130127220001 20130203220001 (2 Replies)
Discussion started by: netdbaind
2 Replies

5. UNIX for Dummies Questions & Answers

[Solved] Finding the latest file in a directory

Hi All, I am using the below command to find the latest file in a dir: ls -tr $v_sftphomedir/$v_sourcefile |tail -1 or ls -t1 $v_sftphomedir/$v_sourcefile |head -1 and the outpur returned is below: /home/cobr_sftp/var/controllingload/Backup/Dbrwds_Div_1796050246.txt I need only the... (5 Replies)
Discussion started by: abhi_123
5 Replies

6. UNIX for Dummies Questions & Answers

Sorting files based on timestamp and picking the latest file

Hi Friends, Newbie to shell scripting Currently i have used the below to sort data based on filenames and datestamp $ printf '%s\n' *.dat* | sort -t. -k3,4 filename_1.dat.20120430.Z filename_2.dat.20120430.Z filename_3.dat.20120430.Z filename_1.dat.20120501.Z filename_2.dat.20120501.Z... (12 Replies)
Discussion started by: robertbrown624
12 Replies

7. Shell Programming and Scripting

Urgent ...pls Sorting files based on timestamp and picking the latest file

Hi Friends, Newbie to shell scripting. Currently i have used the below to sort data based on filenames and datestamp $ printf '%s\n' *.dat* | sort -t. -k3,4 filename_1.dat.20120430.Z filename_2.dat.20120430.Z filename_3.dat.20120430.Z filename_1.dat.20120501.Z filename_2.dat.20120501.Z... (1 Reply)
Discussion started by: robertbrown624
1 Replies

8. Shell Programming and Scripting

Finding the Latest file in a Dir

Hi Everyone, I am writing a shell script and I am struck here: I need to find the latest file in a directory depending upon the date. For example: The files in the directory are: Filename_bo_20110619 Filename_bo_20110620 Filename_bo_20110621 Filename_bo_20110622 So here, I want... (2 Replies)
Discussion started by: filter
2 Replies

9. AIX

Unix shell scripting to find latest file having timestamp embedded...

Hi guys, I have a directory in UNIX having files with the below format, i need to pickup the latest file having recent timestamp embedded on it, then need to rename it to a standard file name. Below is the file format: filename_yyyymmdd.csv, i need to pick the latest and move it with the... (2 Replies)
Discussion started by: kaushik25
2 Replies

10. UNIX for Dummies Questions & Answers

finding latest file in Unix

Hi, i want to search a file in the dir , if file exists for todays date print the message that file found or if file does not exist for todays date/ if file not found i want to display message saying that file not found. How to do this. Thx for your help. (2 Replies)
Discussion started by: nick12
2 Replies
Login or Register to Ask a Question