Showing posts with label unix. Show all posts
Showing posts with label unix. Show all posts

Friday, April 20, 2018

Sort all files of present working directory and sub directories by modified date and time

If you want to sort all files of a folder and its subfolders by modified date and time, Here is the command.
find . -type f -printf "%T@ %Tc %p\n" | sort -n
Latest modified file will be last in the sequence.

If you want to reverse the sequence i.e. latest modified should be on top.
find . -type f -printf "%T@ %Tc %p\n" | sort -nr

Dot (.) indicates the present working directory. You can use absolute path also.