I run Solaris 9 and want to delete some directories older than 2
hours. Like this:
find /MYDIR/ -name "MYPATTERN" -type d -mmin +120 -exec rm -R {} \;
But there ist no option like "mmin" in Solaris 9, I can only select
files older than whole days by "-mtime", but not by hours.
Is there someting like "gnu-find" I can use oder another way to
select files accessed some hours ago?
Thanks!
http://www.gnu.org/software/findutils/
You shouldn't need to do that. You can get GNU find for S9 already
compiled and in package format from any of several sources. It's on
the companion CD as SFWgfind. It's in blastwave.org as findutils.
It's on sunfreeware.com as findutils-4.2.27.
If you're using Solaris and you haven't looked into the free sources
of precompiled software for it, you may want to do that. There's a
lot available.
--
James Carlson, KISS Network <james.d...@sun.com>
Sun Microsystems / 1 Network Drive 71.232W Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757 42.496N Fax +1 781 442 1677
>"JNR" <mjana...@gmail.com> writes:
>> You need to compile and install gnu find.
>>
>> http://www.gnu.org/software/findutils/
>You shouldn't need to do that. You can get GNU find for S9 already
>compiled and in package format from any of several sources. It's on
>the companion CD as SFWgfind. It's in blastwave.org as findutils.
>It's on sunfreeware.com as findutils-4.2.27.
>If you're using Solaris and you haven't looked into the free sources
>of precompiled software for it, you may want to do that. There's a
>lot available.
Or he can use a more recent version of Solaris which does have
the -cmin/amin/mmin options.
Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.
Some finds (from pres SYS V days) are happy with floating point
values for times that reduce to integers in seconds....
find .... -atime +.083333
> I run Solaris 9 and want to delete some directories older than 2
> hours. Like this:
> find /MYDIR/ -name "MYPATTERN" -type d -mmin +120 -exec rm -R {} \;
> But there ist no option like "mmin" in Solaris 9, I can only select
> files older than whole days by "-mtime", but not by hours.
Even if you don't have access to a 'find' that accepts minutes, you can
use 'touch' to create a file of the correct age. Then use find -newer
(or ! -newer) to select files newer or older than that point in time.
--
Darren Dunham ddu...@taos.com
Senior Technical Consultant TAOS http://www.taos.com/
Got some Dr Pepper? San Francisco, CA bay area
< This line left intentionally blank to confuse you. >
Create a timestamp file that is 2 hours old, using TZ tricks, like
touch -t `TZ=GMT+3 date '+%y%m%d%H%M'` .TIMESTAMP
find /dir -type d \! -newer .TIMESTAMP .....
The environ(5) man page has details about the TZ format.
You might have to compensate for std vs dst timezones.
> Even if you don't have access to a 'find' that accepts minutes, you can
> use 'touch' to create a file of the correct age. Then use find -newer
> (or ! -newer) to select files newer or older than that point in time.
Now that is a really neat trick. Do you know (could be easily checked
obviously but I'm not near a Solaris box that is on) if it is smart
enough not to stat the file repeatedly?
--tim
Could look at the code, but no I think it just stats the file once to
get a time (rather like the -mtime and others generate a time) and that
is checked against the files. I only see one stat on a test.
I have installed that package.
I wasn´t quite shure if there was a "find"-package, thanks for the
advice!