Timeline for Get most recent file in a directory on Linux
Current License: CC BY-SA 3.0
2 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 29, 2015 at 16:53 | comment | added | Aaron |
You are correct about the white space problem with @gioele suggestion, but you only need to add a hyphen to the -f option to make it a range to fix that: find $DIR -type f -printf "%T@ %p\n" | sort -n | cut -d' ' -f 2- | tail -n 1 Or alternatively, keep all except the first field: find $DIR -type f -printf "%T@ %p\n" | sort -n | cut -d' ' -f 1 --complement | tail -n 1
|
|
Oct 24, 2014 at 13:50 | history | answered | basic6 | CC BY-SA 3.0 |