Exclude a directory in 'find'

Hi,

I'm in the process of writing a shell script which will be ran under cron hourly and will check for files of specific age in my ftp folder, then moves those over inside a folder called "old" (which is within the ftp dir). But, I'm unable to figure out how to exclude the "old" folder when using 'find'. Basically, 'find' should just skip it but go through every other folder or file inside the ftp dir.

So the question is; how to completely exclude a folder when using 'find' to search?

Thanks :slight_smile:

If you have GNU find then this should work:

find ftp ! -path "*/old/*" -type f -mtime -3

Otherwise, you might need to grep the old dir out after:

find ftp -type f -mtime -3 | grep -v "/old/"