I'm running this shell command to get the most recent 20 PHP files modified on my server.
find . -name '*.php' -printf '%TY-%Tm-%Td %TH:%TM:%TS %Tz %p\n' | sort -r | head -20
The output is like this:
2016-08-08 01:44:45.3820716170 -0700 ./html/index.php
2016-08-07 05:39:29.0000000000 -0700 ./html/thumb.php
2016-08-07 03:01:44.0000000000 -0700 ./html/paths.php
...
According to strftime man page, I should just be able to use %S (and %TS)
%S
The second as a decimal number (range 00 to 60). (The range is up to 60 to allow for occasional leap seconds.)
There is probably something going on with find
, but the other time parameters work as expected. I'm trying to get results like the following. If the extra string is in fact fractional seconds, either rounding or truncating is fine. How can this be done?
2016-08-08 01:44:45 -0700 ./html/index.php
2016-08-07 05:39:29 -0700 ./html/thumb.php
2016-08-07 03:01:44 -0700 ./html/paths.php
...
(and if there is a more efficient way to do what the above command does, I'm all ears.)
find
man page says thatS
includes fractional seconds: "S Second (00.00 .. 61.00). There is a fractional part." and I don't note an option right off that doesn'tfind
(forgive the pun). It would still be nice to remove the fractional seconds if even possible.