I have a bunch of directories with different revisions of the same c++ project within. I'd like to make things sorted out moving each of these directories to a parent directory named by pattern of YYYY.MM.DD
. Where YYYY.MM.DD
is the date of the most recent entry (file or directory) in a directory.
How can I recursively find the date of the most recent entry in a particular directory?
Update
Below is one of the ways to do it:
find . -not -type d -printf "%T+ %p\n" | sort -n | tail -1
Or even:
find . -not -type d -printf "%TY.%Tm.%Td\n" | sort -n | tail -1