[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Semi-OT: Problems getting find to not recurse
- To: misc_(_at_)_openbsd_(_dot_)_org
- Subject: Semi-OT: Problems getting find to not recurse
- From: "C. Bensend" <benny_(_at_)_bennyvision_(_dot_)_com>
- Date: Wed, 6 Jul 2005 10:54:15 -0500 (CDT)
Hey folks,
OK, I think I've got the dunce hat on today, and I'm about to
go crazy with this one.
I have a script on an OpenBSD 3.7-STABLE machine that does
a find in a directory, and uses rm to remove files older than
two days (where RETAIN = "+2") :
find /path/to/dir -type f -name \*.gz -mtime ${RETAIN} -exec rm {} \;
This directory has a subdir (a .ssh), and no matter what I
do, I cannot get find to NOT recurse into this subdirectory. I've
tried using -path, ! -path, -maxdepth 0|1, and none of them seem
to do what I want. I only want find to examine the /path/to/dir
directory, and not any subdirs.
I've been through the man page so many times, I can just about
recite it. Am I just missing something, or is this not possible?
I'm guessing it's the former and I've just stared at it too long to
see the obvious.
Any help greatly appreciated.
Benny
--
"I'd rather staple a skunk to my forehead and go to a trade show
for banjo makers." -- PHB's secretary,
Dilbert, 07-2002
Visit your host, monkey.org