Regarding equating file attributes in "ls" command
I have a folder in which there are thousands of images. Of those thousand images, I want to bring together all those images whose “Last created” and “Last modified” attributes are exactly same.
( In other words, I want to separate all the images I didn’t ever rename for example ) Is there a way to do this from terminal ? these are the two commands that I want to concatenate ls -tU lists file by creation date. (I'm on a mac) ls -lt lists file by modified date such that I want to "List files whose date created = date modified" |
Try the find command?
|
If you are using a file system that supports "time of file birth" in "stat" then you can do it. But as far as I know, EXT4 and HFS+ don't. You can check with "stat" on a file:
Code:
stat -c "%Y %W" ./somefile |
[specific to OSX]
There is mdls command Code:
mdls file.. Code:
mdls -name kMDItemFSCreationDate -name kMDItemFSContentChangeDate file... Code:
stat -f "%m %c" file... |
The usual problem is that no two files are created at "exactly the same time".
If you look at the file dates using the stat command, you will see timestamps into the nanosecond range - thus the dates are almost guaranteed to be unique. Depending on how the files are modified/backed up/restored the modified timestamp MAY be recorded to the second. But the access/creation/birth (if recorded) will be to the nanosecond. |
Just tested in an OSX box, this seems to work:
Code:
cd directory %a: time when file was last accessed %N: file name |
Quote:
Also note that some backup/restore facilities can set the changed and modification dates to whatever is desired...(see "touch" command), and neither has anything to do with created date (which is more properly called "inode modification date"). |
I am looking at what was modified, but I was wrong
Quote:
Code:
stat -f "%c:%a:%N" * | awk -F: '$1 == $2 {print $3}' |
All times are GMT -5. The time now is 06:23 AM. |