Search code examples
shellunixfindunix-timestamp

How to find files older than 60 minutes only in current directory


The following command it finding all the files which are older than 60 minutes but in sub directories also.

find . -type f -mmin +60 -print

How can we restrict it find files only in given directory?

I have archive folders in sub direcotries which have older files that is causing problem.

Thanks in advance :)


Solution

  • Use the -maxdepth 1 argument to find to limit results to the current directory.

    So your full command would be find . -type f -mmin +60 -maxdepth 1 -print