What command should I use to sort all the files in a project directory according to the date of modification?
Tried ls -t
but it does not find the file and used find
to find all the files of the specified type, but could not sort them.
Advertisement
Answer
You can use this to find all the files of the type you are looking for and sorted by the last modified date.
find $directory -type f -name "*.type" -print0 | xargs -0 stat -c "%y %n" | sort
The above looks for all the files of type “type” and then sorts it according to the last modified timestamp.