List/compare a directory's files' creation and modification dates
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
List/compare a directory's files' creation and modification dates
I'm sure there is an easy way to do this, but I just can't seem to figure it out. I am trying to find files that have been updated since their original creation date. It would be great to issue a command that will give me this information. I would also be perfectly happy to have some sort of 'ls' command that lists both the creation and modification dates so I can manually check the output for ones that have been updated. Of course the first option is ideal, but right now I'm just looking for any solution.
Is there a command out there that will do this for me? Right now I'm only seeing how to list the modification dates.
. It seems to be working a little weird on my system, as it's displaying creation time when I do -al and modification time when I do -alc, but *shrug*. According to the ls man pages, you use the --time=TIME switch to modify what the time column (the column that shows the modification time). Just mess around with it a bit, maybe create a bash script that throws in a few greps along with those ls's and you should be good.
Unfortunately, the system does not store information about creation time. You can have ctime (change time), mtime (modification time) and atime (access time).
If the file's properties or permissions are changed, ctime changes. If the file is accessed, atime changes. If the file is modified, both atime and mtime change.
For new files and files that have not been modified or changed since creation, ctime equals creation time. But, as soon as file properties are changed, and a file is modified, all information about creation time is lost.
You only hope is that file properties have not been changed since creation. In that case, access and modification times differ from ctime (with ctime having the earlier date and time).
To see all three times, use stat, as in 'stat <filename>'. With stat, and a bit of awk magic (since the stat output is arranged in horizontal records with distinct fields), you could write a script to select files based on differences between ctime and atime or mtime. However, it won't be exact, for reasons stated above.
Unfortunately, the system does not store information about creation time. You can have ctime (change time), mtime (modification time) and atime (access time).
If the file's properties or permissions are changed, ctime changes. If the file is accessed, atime changes. If the file is modified, both atime and mtime change.
For new files and files that have not been modified or changed since creation, ctime equals creation time. But, as soon as file properties are changed, and a file is modified, all information about creation time is lost.
You only hope is that file properties have not been changed since creation. In that case, access and modification times differ from ctime (with ctime having the earlier date and time).
To see all three times, use stat, as in 'stat <filename>'. With stat, and a bit of awk magic (since the stat output is arranged in horizontal records with distinct fields), you could write a script to select files based on differences between ctime and atime or mtime. However, it won't be exact, for reasons stated above.
Ah, I assumed ctime was creation time since it did not say what it was exactly in the man pages. My mistake. =[
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.