files older than a certain time


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting files older than a certain time
# 1  
Old 04-04-2011
files older than a certain time

I know how to find files, which are newer than a specific time.

Code:
 
touch -t 201103300650 dummy
find /path/to/files -type f -newer dummy -exec ls -l {} \;

Is there a way to find files, which are older than a specific time?
# 2  
Old 04-04-2011
what's the opposite of 'newer'? Older?
Code:
find /path/to/files -type f ! -newer dummy -exec ls -l {} \;

This User Gave Thanks to vgersh99 For This Post:
# 3  
Old 04-04-2011
Quote:
Originally Posted by BeefStu
I know how to find files, which are newer than a specific time.

Code:
 
touch -t 201103300650 dummy
find /path/to/files -type f -newer dummy -exec ls -l {} \;

Is there a way to find files, which are older than a specific time?
And -ls is enough.
Code:
find /path/to/files -type f ! -newer dummy -ls 

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Find if create time of last created file in a directory is older than 5 minutes

A process xyz is running and creating file1, file2, file3, .... filen. how do i know if the process has stopped and createtime of the last file (filen) is older than 5 minutes? OS is AIX (3 Replies)
Discussion started by: malaika
3 Replies

2. Shell Programming and Scripting

Remove lines having older end time

Hi, In my bash script I want to add a code which remove all entries older than x days. To simplify this problem, I have divided into 3 parts. (2 parts are done looking answer for 3rd part.) To find the latest log date - Done Latest_Time=`find . -name '*.tps' -exec sed '/endTime/!d; s/{//;... (3 Replies)
Discussion started by: Agoyals1986
3 Replies

3. UNIX for Beginners Questions & Answers

Total size utilizes by the files older than a time span

Through find command I identified the files older that 1 year. I need the overall size utilizes by these 1 year older files. Please share me the command to identify it .Thanks Please post in an adequate technical forum! (3 Replies)
Discussion started by: Sang
3 Replies

4. UNIX for Beginners Questions & Answers

How to move files older than certain time?

If there are 100 files created in a directory /data/ today from 2:00 AM to 10:00 AM I need to move files older than 3:00 AM to a new directory /hold/ How to do that? Also, if I have to move files between 3:00 AM to 9:00 AM, how to achieve that (3 Replies)
Discussion started by: eskay
3 Replies

5. Shell Programming and Scripting

How to create zip/gz/tar files for if the files are older than particular days in UNIX or Linux?

I need a script file for backup (zip or tar or gz) of old log files in our unix server (causing the space problem). Could you please help me to create the zip or gz files for each log files in current directory and sub-directories also? I found one command which is to create gz file for the... (4 Replies)
Discussion started by: Mallikgm
4 Replies

6. Shell Programming and Scripting

Archiving older files

Hello Group, I would request your help to build a shell script in order to find files older than 90 days then create the same directory structure under the second disk (/archive directory) and move the file preserving the same timestamps (ownership, etc). Also keep the log of files moved... (4 Replies)
Discussion started by: csierra
4 Replies

7. Shell Programming and Scripting

how to delete the older files other than the recently added 5 files

Number of files will get created in a folder automatically daily.. so i hav to delete the older files other than the recently added 5 files.. Could u help me through this..?? (5 Replies)
Discussion started by: shaal89
5 Replies

8. Shell Programming and Scripting

ftp only older files

Hi All, I want to get those the files which were created before 20 days. Say, we have two server, remote server and local server. I want to get only 20 days older files from remote server to my local server. I have used following code for ftp: (echo " user ${USERNAME}... (2 Replies)
Discussion started by: priyankak
2 Replies

9. Shell Programming and Scripting

Finding files older than the current date and time and renaming and moving

Hi, I have a very urgent requirement here. I have to find all files in the specified directory but not in the sub directories(The directory name is stored in a variable) which are older than the current date as well as current time and rename it as filename_yyyymmddhhmmss.ext and move it into a... (7 Replies)
Discussion started by: ragavhere
7 Replies

10. UNIX for Dummies Questions & Answers

rm files older than ...

Hello, How can I remove files older than yesterday or the day before or a given day ... Thank you in advance (2 Replies)
Discussion started by: annemar
2 Replies
Login or Register to Ask a Question