Command to find only mtime
I've got a script where I have to parse out the last modified time for a large amount of files.
Piping the output for "ls" into "cut" seems to work most of the time, but the output is unpredictable. The "fields" argument doesn't find the date modified columns consistently, and using character count is as well since the output can vary in width depending on the file name.
Is there a command that specifically displays the mtime of a file?
You might like the `stat` command:
You can change the way the date/time field is displayed to make it consistent:
ls -ltc --time-style=long-iso
See the ls man page for details and other styles.
Hope this helps.
Thanks to both for replying! The stat command seems to work best for my needs. I don't have much control over the format, but my dependence on "cut" parsing the output is lessened because I have less fields to work with.
|All times are GMT -5. The time now is 08:56 AM.|