How to find Directories that updated last day in linux?

To find dirs containing files modified in the last 24 hours:

find [dir-to-search] -type f -mtime -1 -exec dirname {} \; | sort --unique

Change the mtime -1 to mtime -2 to search the last 48 hours, or change it to mmin -120 to search the last 2 hours

Edit: explanation:

Searches dir-to-search (or current dir if not provided) recursively for entries of type f (file) which were modified less than (1*24) hours ago. Execute the dirname command for each of these. This will give one dirname listing for each file, which may result in many duplicates, so pipe the output to sort and ask it to extract unique dirnames.


You can use -type d in the find string:

find /path/to/target -type d -mtime 1