Find last modified date for many files


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Find last modified date for many files
# 1  
Old 02-15-2010
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 the most recently updated files (if there are any) brought to the bottom of the list. Similar to the ls -ltr command.

Thanks!
Mike
# 2  
Old 02-15-2010
Tools Did you see this article?

Please take a look at this other posting:
https://www.unix.com/unix-dummies-que...date-file.html
# 3  
Old 02-15-2010
link did not help this time.

I think that is just for file extentions and didn't really help. the ls -latr command works but returns the output of the files for only the directory I am in, not the subdirectories. Thank you anyways!

---------- Post updated at 12:01 PM ---------- Previous update was at 11:32 AM ----------

I ended up doing a "find . -mtime -20 -print" to identify the files in the directory that were not updated in the last 20 days. Since I was using this to ensure that no files were being placed in the mount point that was decommissioned over 20 days ago. Thank you for your assistance.
# 4  
Old 02-15-2010
Code:
ls -latr  $(find /path/to/files -type f)

ls will "sort" filename arguments given to it on the command line.
# 5  
Old 02-18-2010
I think the most straight forward way is to use the -exec option in find command

Code:
 
find <filepath> -exec ls -latr {} \;

Is that the thing you want ?
# 6  
Old 02-28-2010
listing file mod time

I would add a -type switch for the find command, since you are only looking for flat files and not directories.

Also, for consideration - I have often struggled about how to do these simple unix things on windows and had to search and search for something similar - found in form of biterscripting.

To list file mod time of all flat files in a directory and all its subdirectory, you can use this corresponding command in biterscipting on windows

ls -r -n -m "*" "/path/to/files" ($ftype=="f")


Similar commands to grep, awk, wc, sed, etc. are also there. Thought should mention this since many of us use both unix and windows simultaneously.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find file by filename or with newest modified date

Hi, I have a directory that has numerous files in it, and there is two which are named "filerec_ddmmyyHH24MMSS" by the time they are created so "filerec_010615012250" was created at 01:22:50 on 1st June 2015. I need to find the most recently created of those 2 files and get the contents of... (4 Replies)
Discussion started by: finn
4 Replies

2. Shell Programming and Scripting

How to find all files modified from midnight (i.e. from midnight (00:00:00)) of current date?

Hi there! I was wondering if someone could help me with the following: I'm trying to find all files within a directory which have been modified since midnight of the current date. Any help would be appreciated. Thank you kindly. (6 Replies)
Discussion started by: Jimmy_the_tulip
6 Replies

3. 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

4. Emergency UNIX and Linux Support

Is there any way to set the files modified date and stamp to last modifies time?

Actually i did modification in a file on server by mistake, now its showing current time stamp, is there any way to set the files modified date and stamp to last modifies time. Please advice here.Thanks in advance.:b: (7 Replies)
Discussion started by: saluja.deepak
7 Replies

5. 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

6. 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

7. 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

8. Shell Programming and Scripting

help: find and modified files script

hello all im a newbie in the linux world ..i have just started creating basic scripts in linux ..i am using rhel 5 ..the thing is i wanted to create a find script where i could find the last modified file and directory in the directory given as input by the user and storing the output in a file so... (6 Replies)
Discussion started by: tarunicon
6 Replies

9. UNIX for Dummies Questions & Answers

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... (4 Replies)
Discussion started by: rkka
4 Replies

10. 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
Login or Register to Ask a Question