Does anyone know if find command do full disk scan if I apply -mtime +30? I am worrying that when number of directory grow, it will become deadlock whenever I run find, and trying to find a way to limit number of directory it search, but not sure even define mtime would still search for every directory.
does find command do full disk scan if apply -mtime +30?
linux;shell;find
find will scan a directory tree (this is not necessarily a full disk).By default, find will examine directories to return every file in the hierarchy.  TESTS (such as -mtime) do not modify which files are returned.  Unless combined with some ACTION (like -prune or -quit), the mod times of the files won't affect the search space.The various OPTIONS, TESTS, and ACTIONS are outlined in the man page.I am worrying that when number of directory grow, it will become  deadlock whenever I run find, and trying to find a way to limit number  of directory it searchI'm not sure why deadlock is a worry.  As the files increase, the amount of work find has to do increases as well.  But it should always complete.  Unless you have some information about which files in your hierarchy may or may not match, neither find nor the filesystem can help.  The only way to print every possible match is to examine every possible file.Now if you have some information that can limit which ones are possible, you might be able to add in some actions that reduce the work that is done.