Recent GNU versions of find
also include a -printf
option which includes date fields. If you need to print the file's name and modification time in the standard "C" format, you can use -printf "%c %p\n"
.
If you want the date in a specific format, you can use the %C
followed by a field character. For example, 4-digit year would be %CY
, with Y
being the character for 4-digit year.
Note that if you need multiple fields, you'll need to specify %C
multiple times. For example, YYYY-MM-DD format would look like %CY-%Cm-%Cd
.
Check the man pages or online documentation for additional details.
Here is a working example:
find . -name favicon.ico -printf "%c %p\n"