How can I find the most recently modified *.ipynb files in the subtree starting from the current directory? Ideally I would like a sorted list with the most recently modified ones shown first.
I am using Ubuntu 22.04 and am happy to use GNU tools.
CodePudding user response:
Like this:
(
shopt -s globstar
ls -lt **/*.ipynb
)
CodePudding user response:
You can use find
to get files containing certain name along with stat
to get the date of last modification. All that is left is using sort
to put them in order:
find . -type f -iname '*.ipynb' -exec stat --format="%y %n" {} \; | sort
This will show an accurate time of modification down to the second.
2022-08-24 05:53:38.525297805 -0400 ./Desktop/fileone.pynb
2022-11-04 01:51:18.894946451 -0400 ./.local/filetwo.pynb
2022-11-13 20:26:53.897667918 -0500 ./go/pkg/mod/github.com/filethree.pynb