Find files older then today & display with timestamp info


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Find files older then today & display with timestamp info
# 1  
Old 01-02-2009
Find files older then today & display with timestamp info

Small query-

I want to do some operation on all the files older then today. Before I do that operation, i want to verify if the command works properly or not.

Surprisingly, the command below returns me file, which are created today -

find /mrk_archive/PG/ftp/incomming/gbs/2008 -type f -mtime +1 -print| ls -lst | more

Is there any other way to see the files selected by find , sorted as per the date with the timestamp information?

Thanks & a Happy New Year !!

Last edited by kedar.mehta; 02-19-2009 at 05:10 PM..
# 2  
Old 01-02-2009
mtime is the right option, just try incrementing to 2+. BTW, you can use -ls as an option to find rather than print and you won't have to pipe to the ls command.
Padow
# 3  
Old 01-02-2009
Thanks, man..

One surprising thing,

Both of command below returns me the same set of result.
  • find /mrk/ftp/incoming/gbs -type f -mtime +0 -ls
  • find /mrk/ftp/incoming/gbs -type f -mtime +1 -ls
Where as,
find /mrk/ftp/incoming/gbs -type f -mtime 0 -ls
returns results of previsous day.

Consider today is 2nd jan, then it shows all only results of 1st Jan .. !!

Last edited by kedar.mehta; 02-19-2009 at 05:11 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find files from only today

This finds files from yesterday and today. I need it to find only files from today. sudo find /home/andy -iname "*.sh" -mtime -1 -print (8 Replies)
Discussion started by: drew77
8 Replies

2. Shell Programming and Scripting

Error when connecting to remote server to find files with timestamp today's day

I am connecting to remote server and try to check if files with timestamp as Today's day are on the directory. Below is my code TARFILE=${NAME}.tar TARGZFILE=${NAME}.tar.gz ssh ${DESTSERVNAME} 'cd /export/home/iciprod/download/let/monthly; Today=`date +%Y%m%d`; if ;then echo "We... (1 Reply)
Discussion started by: digioleg54
1 Replies

3. Shell Programming and Scripting

To check timestamp in logfile and display lines upto 3 hours before current timestamp

Hi Friends, I have the following logfile. Currently time in india is 07/31/2014 12:33:34 and i have the following content in logfile. I want to display only those entries which contain string 'Exception' within last 3 hours. In this case, it would be the last line only I can get the... (12 Replies)
Discussion started by: srkmish
12 Replies

4. UNIX for Dummies Questions & Answers

Display files based on particular file timestamp

Hi, I have requirement to list out files that are created after particular file. ex. I have below files in my directory. I want to display files created after /dirdat/CG1/cg004440 file. ./dirdat/CG1/cg004438 09/07/14 0:44:05 ./dirdat/CG1/cg004439 09/07/14 6:01:48 ... (3 Replies)
Discussion started by: tmalik79
3 Replies

5. Shell Programming and Scripting

Delete files older than today

is it -mtime +1 as i need all files older than today to be deleted (6 Replies)
Discussion started by: dinjo_jo
6 Replies

6. Shell Programming and Scripting

Getting all the files modified today & store the names in a variable as , separated

Hi all, I have a question. I have a folder. I want to find the list of files that are modified today and store all those file names in a variable as comma separated values. I thought of using "find . -mtime 0" command to find the list of files modified today. Also to get those values of file... (10 Replies)
Discussion started by: ananthi_ku
10 Replies

7. Shell Programming and Scripting

display the files in a folder which are older than 1 hour

Hi, I have some files in a folder with different time stamps and I want to display the files which are older than 1 hour. i tried with find. need urgent help. (7 Replies)
Discussion started by: vgs
7 Replies

8. UNIX for Dummies Questions & Answers

display the files in a folder which are older than 1 hour

Hi, I have some files in a folder with different time stamps and I want to display the files which are older than 1 hour. i tried with find. need urgent help. (3 Replies)
Discussion started by: vgs
3 Replies

9. Shell Programming and Scripting

Find files older than 20 days & not use find

I need to find files that have the ending of .out and that are older than 20 days. However, I cannot use find as I do not want to search in the directories that are underneath the directory that I am searching in. How can this be done?? Find returns files that I do not want. (2 Replies)
Discussion started by: halo98
2 Replies

10. Shell Programming and Scripting

how to find today's files & send to another server?

Hi All, My script has to find todays modified( less than 24 hrs) files & send it another server using SCP. what I wrote is find . -type f -mtime -1 | xargs ls -ltr ## to find today's files, but its giving my sh_history file also, I don't require this file at all. scp... (4 Replies)
Discussion started by: zinu
4 Replies
Login or Register to Ask a Question