Getting Latest files


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Getting Latest files
# 1  
Old 04-18-2011
Getting Latest files

Hai
I wolud like to know how to get the latest files.
ex:
file_ssss_00
file_ssss_01

i need to get file_ssss_01 files only. (in Unix script)

Please give some idea ...
# 2  
Old 04-18-2011
latest file

You can use ls -lrt|tail -1
# 3  
Old 04-18-2011
You can leave the -l off if you don't want the long format. just ls -rt.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Latest list of files of each type

find /tmp/testlog/kSR*"_"2018* -type f -printf '%T@ %p\n' | sort -n | tail -3 | cut -f2- -d" " /tmp/testlog/log/KSR04_2018-07-05.log /tmp/testlog/log/KSR04_2018-07-06.log /tmp/testlog/log/KSR01_2018-07-06.log But, I would see the following output(latest files for each KSR tuype) ... (3 Replies)
Discussion started by: jhonnyrip
3 Replies

2. Shell Programming and Scripting

Need help with finding the latest files

Hi, Actually i got a client requirment and i need experts help here. we have 30 parent directories and in that we have so many subdirectories and files. i want to find only latest timestamp files with out touching subdirectories and need to redirect the latest files into some other... (3 Replies)
Discussion started by: lkeswar
3 Replies

3. Shell Programming and Scripting

How to retrieve the latest files from the directory.?

hi, i have some file in a directory say p1.txt.201305051200.lst p1.txt.201305051300.lst p1.txt.201306051200.lst p1.txt.201306051300.lst p2.txt.201306051200.lst p2.txt.201306051300.lst i am using p* pattern to retrieve these file ls -1 p* the files in red color are the latest... (7 Replies)
Discussion started by: Little
7 Replies

4. Red Hat

List all old files except 15 latest files

Guys, Someone please guide me to tell me how do I print and later remove all old files in a folder recursively but keep only latest 15 modified files. When I do - ls -tp | head -15 I get the list of last 15 modified files whereas I need the list of all OTHER files except these files. ... (3 Replies)
Discussion started by: rockf1bull
3 Replies

5. Shell Programming and Scripting

How to backup latest date files?

Hi, I have below two situations to handle, 1. I have list of files with file names having date&time. I have to backup to old date files. say I have below files in a directory, 1. XX123_20101004010101.dat 2. XX124_20101004010201.dat 3. XX121_20101003010101.dat 4.... (6 Replies)
Discussion started by: smr_rashmy
6 Replies

6. Shell Programming and Scripting

Delete all Files except the Latest Files

Hi, In my scenario, i just want to delete all the files except the latest one. How can I do? Please reply me. (3 Replies)
Discussion started by: spkandy
3 Replies

7. UNIX for Dummies Questions & Answers

To list only the very latest files

Hi, There are huge no of files in the directory. If i say ls -ltr it is taking too much time. i want to see only the files for Feb,2009. Please help. Thanks (3 Replies)
Discussion started by: venkatesht
3 Replies

8. Shell Programming and Scripting

Pick the latest set of files

I have task in which I need to pickup a set of files from a directory depending on the following criteria: Every month 6 files are expected to arrive at /test. The files come with date timestamp and the latest file set for the month needs to be used Suppose this is the set of files that present... (5 Replies)
Discussion started by: w020637
5 Replies

9. Shell Programming and Scripting

Retain 3 latest files

Guys, Please can you tell me how to retain 3 latest files in a directory and get rid of the rest ? Thanks very much Regards, Ganesh (6 Replies)
Discussion started by: kamathg
6 Replies

10. UNIX for Dummies Questions & Answers

Copying files with the latest date

Hi All, I have a situation where I need to copy the files having the latest date. For example I have a file by name bas100e1_jun05. I need to copy it to bas100e1. But when a file by name bas100e1_jul05 is put in the same directory the script should copy the file having the latest month which... (34 Replies)
Discussion started by: shashi_kiran_v
34 Replies
Login or Register to Ask a Question