Hi,
Has anyone tried to restrict Solaris 10 unix find on a large directory structure based on time to stop running after finding the first occurrence of a matching query. Basically I'm trying to build up a usage map of user workspaces based on file modification (week/month/3 months/year etc) and I know if I can get find to stop after finding something modified in the last year in the very first directory instead of running to the bottom getting all files the program would run a lot faster:
Excerpt:
week=Yes; month=Yes; month6=Yes; year=Yes; year2=Yes
if [[ -z \`find "$\{DIR\}/$\{j\}" -mtime -730\` ]];then
week=No; month=No; month6=No; year=No; year2=No
else
if [[ -z \`find "$\{DIR\}/$\{j\}" -mtime -365\` ]];then
week=No; month=No; month6=No; year=No
else
if [[ -z \`find "$\{DIR\}/$\{j\}" -mtime -180\` ]];then
week=No; month=No; month6=No
else
if [[ -z \`find "$\{DIR\}/$\{j\}" -mtime -30\` ]];then
week=No; month=No;
else
if [[ -z \`find "$\{DIR\}/$\{j\}" -mtime -7\` ]];then
week=No;
fi
fi
fi
fi
fi
Thanks in advance,
John