I would like to get the number of files in a directory and its sub-directories (recursively) that was created year 2016. I only care about files that has a specific file ending, for example ".txt". How can I achieve this in the terminal?
Find number of files in directory that has been created specific year
datefilesfind
Best Answer
With GNU
find
:This counts the files with a
ctime
in 2016 in the local timezone. Please note thatctime
is not the creation time of the files, but it's about the best approximation of it you can hope for with standard UNIX semantics.If you want to match modification time you can use
-printf '%TY\n'
above instead of-printf '%CY\n'
.