Hi All,
I want to search only files more than 60 min in particular directory but not in sub directories.
with this command i am getting even sub directires also.Please and let me know how to get the files.
$i=`find /home/n1013141/vijay -type f -mmin -60`;
print $i;
o/p:/home/n1013141/vijay/test/time.pl
Test is one more directory.
Waiting for valuable reply.
Regards,
vijay
use maxdepth option with find
man find
shows the following
-maxdepth levels
Descend at most levels (a non-negative integer) levels of directories below the command line arguments.
'-maxdepth 0' means only apply the tests and actions to the command line arguments.
Hi All,
I am using like this.But its saying maxdepth is not valid option. "find: 0652-017 -maxdepth 0 is not a valid option"
find /home/n1013141/vijay '-maxdepth 0' -type f -mmin -60
Please help me
Regards,
vijay
find /home/n1013141/vijay -maxdepth 1 -type f -mmin -60
It appears that your find implementation doesn't support the -maxdepth predicate. Fortunately, you can accomplish this task without it:
find /home/n1013141/vijay -type f -mmin -6 -print -o -type d ! \( -name vijay -exec test {} = /home/n1013141/vijay \; \) -prune
Regards,
Alister
Hi Alister,
Thanks alot for your help.Its working very good.
Regards,
vijay,