Create a list of files that were modified after a given date.

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Create a list of files that were modified after a given date.
# 1  
Old 01-22-2008
Create a list of files that were modified after a given date.

Hello Mates! I'm kinda new to unix and need to a solve a problem.

Input: date

Situation: With the given date I need to find a list of all such files starting from a given path that were modified after the given date.

I experimented with the "find" with "-newer" but did not quite get it to work. Any clarifications through examples appreciated!

Any other pointers on how to solve this would be helpful!!

Thanks in advance!

# 2  
Old 01-22-2008
please check like this :
find . -ctime +30 -exec ls -l {} \;

Last edited by Yogesh Sawant; 02-14-2011 at 07:46 AM.. Reason: added code tags
# 3  
Old 01-22-2008
thanks for the reply.
please could you explain the "-ctime +30" portion. I dont get it.
# 4  
Old 01-22-2008
"-atime/-ctime/-mtime" the last time a files's "access time", "file status" and "modification time", measured in days or minutes. Time interval in options -ctime, -mtime and -atime is an integer with optional sign.

* n: If the integer n does not have sign this means exactly n days ago, 0 means today.

* +n: if it has plus sing, then it means "more then n days ago", or older then n,

* -n: if it has the minus sign, then it means less than n days ago (-n), or younger then n. It's evident that -1 and 0 are the same and both means "today".

* Examples:

o Find everything in your home directory modified in the last 24 hours:
+ find $HOME -mtime 0

o Find everything in your home directory modified in the last 7 days:
+ find $HOME -mtime -7

o Find everything in your home directory that have NOT been modified in the last year:
+ find $HOME -mtime +365

o To find html files that have been modified in the last seven days, I can use -mtime with the argument -7 (include the hyphen):

find . -mtime -7 -name "*.html" -print

If you use the number 7 (without a hyphen), find will match only html files that were modified exactly seven days ago:

find . -mtime 7 -name "*.html" -print

o To find those html files that I haven't touched for at least 7 days, I use +7:

find . -mtime +7 -name "*.html" -print
# 5  
Old 01-22-2008
hey mate! that was a real eye opener. i was getting a bit put off by the description in the man files...

thanks again!!

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

List files with date, create directory, move to the created directory

Hi all, i have a folder, with tons of files containing as following, on /my/folder/jobs/ some_name_2016-01-17-22-38-58_some some_name_2016-01-17-22-40-30_some some_name_2016-01-17-22-48-50_some and these can be lots of similar files,... (6 Replies)
Discussion started by: charli1
6 Replies

2. Shell Programming and Scripting

How to get the files which has modified date as yesterday and before?

Hi All, Can you please help me to get only the files which has the modified date as yesterday and before? Thanks in advance! Regards, Velava.S (4 Replies)
Discussion started by: velava
4 Replies

3. UNIX for Dummies Questions & Answers

mv folders/files without changing modified date?

Hi all, I'm using Red Hat Linux and want to move some folders and files around but not change the modified date. Is this possible? I know cp has a -p flag which seems to do what I want, but this is a large volume of data so copying and deleting would not be feasible. (13 Replies)
Discussion started by: Annorax
13 Replies

4. Shell Programming and Scripting

FTP files modified after a particular date between servers

Hi all, i need to write a shell script to transfer a file modified after a particular date from one server to another. I searched for the related posts in this forum and got hints and snippets for it. i tried the below code ftp serverA user uname pwd lcd to_dir cd from_dir files=$(find... (7 Replies)
Discussion started by: mick_000
7 Replies

5. UNIX for Dummies Questions & Answers

Number of files in a directory modified on a date

Hi How to list all the files in a directory that are modified on a particular date? Also need to know the count,i.e number of files modified on a particular date. Thanks Ashok (1 Reply)
Discussion started by: ashok.k
1 Replies

6. UNIX for Dummies Questions & Answers

Find last modified date for many files

Hello all - I've looked and have not been able to find a "find" command that will list the last modified date of files within a specific directory and its subdirectories. If anyone knows of such a command it would be very much appreciated! If possible, I would like to sort this output and have... (5 Replies)
Discussion started by: MichaelH3947
5 Replies

7. Shell Programming and Scripting

Finding modified File List after the chosen date in Korne Shell...

I am trying to write a Korne Shell asking the user for a date and a directory and then search recursively in this directory the list of files modified after the date chosen. But I am not getting good results when I Test it... #!/usr/bin/ksh echo "Enter a date (YYYYMMDD) " read date touch -t... (2 Replies)
Discussion started by: marconi
2 Replies

8. Linux

compare files in the system with last modified date

HI, I have some files in my Linux machine that are very old and occupy a HUGe amount of space. I am trying to delete these files from the system so that it will be easy for me to add some files. I would like to know if this can done through a Perl or a shell script. What i want to do is i... (6 Replies)
Discussion started by: bsandeep_80
6 Replies

9. UNIX for Dummies Questions & Answers

how to know year create/modified files?

Dear all, how to know created file time, include the year created/last modified? if using #ls -al only month date and time Thank you. (5 Replies)
Discussion started by: blesets
5 Replies

10. UNIX for Dummies Questions & Answers

list last 10 days modified files

All, Is there is anyother single command that will handle ls -lrt | tail -10 Please let me know Thanks, Arun. (1 Reply)
Discussion started by: arunkumar_mca
1 Replies
Login or Register to Ask a Question