With the following command I have been able to list all the directories relative to the current directory along with the epoch time last modified:
find . -exec stat -c '%n: %Y' {} \;
the output looks something like this:
.: 1569247414
./a_file.txt: 1561624333
./some_folder: 1561624645
./some_folder/some_file.txt: 1561624645
./some_folder/another_file.txt: 1536557809
How would I go about getting rid of the "./" appearing at the beginning of every entry, and add a '/' if it is a directory?
As a bonus, getting rid of the first entry '.' which is just the current folder would be nice.
Cheers
-mindepth 1
to get rid of.
which is depth==0find *
instead offind .
-type d ... -or -type f ...
+
instead of\;
to send multiple files tostat
; it can handle it and will be much faster !BUT...
You don't need
-exec stat
at all !find
s bultin-printf
to print the last modification date (%Cs
would be the equivalent tostat
's%Y
).-printf '%P'
instead of%p
will also let you get rid of./
at the beginning of each file name.Output: