-- Russ Berger Technical Account Manager (208)383-4807 Business Critical Support Team Russell.Berger_at_digital.com Compaq Services **************************************************************************** *********************************** find /var/adm/syslog.dated -depth -type d -exec script_that_checks_and_rm.sh {} \ ; Nix. Nikola Milutinovic [Nikola.Milutinovic_at_ev.co.yu] **************************************************************************** *********************************** I *believe* GNU find has such feature, but I am not sure (I once installed it on an Ultrix system which was lacking another find feature I had on Sun, and now have on DU ... I believe the man page mentioned also a granularity finer than a day, but I never needed it). ---------------------------------------------------------------------------- Lucio Chiappetti - IFCTR/CNR - via Bassini 15 - I-20133 Milano (Italy) ---------------------------------------------------------------------------- L'Italia ripudia la guerra [...] come Italy repudiates war {...] as a mezzo di risoluzione delle controversie way of resolution of international internazionali controversies [Art. 11 Constitution of the Italian Republic] ---------------------------------------------------------------------------- For more info : http://www.ifctr.mi.cnr.it/~lucio/personal.html <http://www.ifctr.mi.cnr.it/~lucio/personal.html> ---------------------------------------------------------------------------- **************************************************************************** *********************************** Quick and dirty: man find * newer file TRUE if the current file was modified more recently than the file indi-cated by file. touch -t <suitable time> myfile find . -newer myfile or find . ! -newer myfile my 0.02euros -- (O> gu1d0 - guido_at_dsnet.it <mailto:guido_at_dsnet.it> - http://staff.dsnet.it/~guido <http://staff.dsnet.it/~guido> //\ GB10958 - Unix BOFH / Network Guy - PGP key available V_/_ "Unix _is_ user-friendly. Just _very_ selective about his friends." We have more to fear from the bungling of the incompetent than from the machinations of the wicked. **************************************************************************** *********************************** GNU find (part of GNU findutils in ftp://prep.ai.mit.edu/gnu/findutils/ <ftp://prep.ai.mit.edu/gnu/findutils/> ) has some options to specify times in minutes: > find /var/adm/syslog.dated -depth -type d -ctime +5 -exec rm -rf {} \ ; gnufind /foo -type f -cmin +120 -exec blah {} \; HTH (and happy new year !) -- _ ___ _| / __| Andrea Paolini . Responsabile sistemi e networking / . \__ \ DS Logics Srl . Via S.Felice 98 . Bologna . ITALY \___,___/ NET Email: ap_at_dsnet.it <mailto:ap_at_dsnet.it> . Phone: +39-051-6583011 **************************************************************************** *********************************** One way is to install the GNU findutils package (ftp://gatekeeper.dec.com/pub/GNU/findutils/ <ftp://gatekeeper.dec.com/pub/GNU/findutils/> ) which adds options for smaller age units. Specifically, '-cmin 120' for your example. If you have installed Perl, you probably have a 'find2perl' command that will output a Perl script that will also do the trick (after some easy modifications). For example: find2perl /var/adm/syslog.dated -depth -type d -ctime +5 -exec rm -rf {} \; > p1 ... then edit p1 to change '5' to (say) 0.08333 Hope one of these ideas helps some. -- * Paul A. Sand | perl -e 'print "Just \ * University of New Hampshire | another unimaginative \ * pas_at_unh.edu <mailto:pas_at_unh.edu> | Perl hacker.\n"' * http://pubpages.unh.edu/~pas <http://pubpages.unh.edu/~pas> | **************************************************************************** *********************************** Try my awk script by fiddling with the time and deciding what you want to do with the output. I posted this to the group last year as a way of finding out of time pop temp files and locks. ## This awk program checks for a lock file and removes it if its over 15 minutes old ## Run it with a cron every 10 mins. It will look at the oldest lock and whack ## it if over 15 mins. If < 15 mins or no locks it will exit safely. BEGIN { while(1){ "date" | getline d split (d,darray," ") split (darray[4],t2,":") tnow = darray[3]*1440 +t2[1]* 60 + t2[2] ## get date and parse it. create a value for minutes since day 1 of month l="" "ls -lrt /data3/spool/mail | grep \.lock | grep -v clan" | getline l print l ## edit above statement to reflect path to file or group of files u r monitoring split (l,array," ") print array[9] # if (array[6] != darray[2]) tnow = 1440 ## handle special case of file creation and time now being in different months split(array[8],larray,":") t=array[7] *1440 +larray[1]*60 + larray[2] ## create a value in mins since day 1 of month of file creation time if(t==0) exit {if (tnow - t > 15) system("rm /data3/spool/mail/" array[9]) ## whack it else exit } } } regards stuart mckenzie **************************************************************************** *********************************** If you have all the time in the world, you can use find to find all files younger than a day, then in an -exec clause, feed ls -l through a sed or grep filter and/or some time calculation to only display the ones matching your time criterion. But if you have lots of new files, it would probably be better to write a program something like 'find' with finer granularity so you're not spawning lots of 'ls' processes. -- J.James(Jim)Belonis II, U of Washington Physics Computer Cost Center Manager belonis_at_phys.washington.edu <mailto:belonis_at_phys.washington.edu> Internet University of Washington Physics Dept. http://www.phys.washington.edu/~belonis <http://www.phys.washington.edu/~belonis> r. B234 Physics Astronomy Building 1pm to midnite 7 days (206) 685-8695 Box 351560 Seattle, WA 98195-1560 **************************************************************************** *********************************** Get GNU findutils at www.gnu.org <http://www.gnu.org> . Naccarato, Robert [naccarar_at_bis.adp.com] **************************************************************************** *********************************** You could touch a file to set it's modification time to the time threshold you are interested in, then use -newer touched_file. Or you could get GNU find, which permits smaller times to be specified. Ian Goodacre Computer and Telecommunication Services (CTS) Management Board Secretariat 155 University Avenue, 8th floor Toronto, Ontario, M5H 3B7 Tel: 416-327-1092 Fax: 416-327-3281 **************************************************************************** *********************************** I work this by using touch to create a file with the time stamp I am interested in. I then use find -older (actually, I usually am using find -newer) to find the files. Regards, Mandell Degerness Mandell.Degerness_at_gems2.gov.bc.ca <mailto:Mandell.Degerness_at_gems2.gov.bc.ca> **************************************************************************** *********************************** I'm hoping you have received several replies. They should all say something like: Get the GNU version of find from any of the GNU/FSF mirror sites. It will allow finds at the hour level. Try: http://www.gnu.org/server/list-mirrors.es.html <http://www.gnu.org/server/list-mirrors.es.html> *********************** Wayne Sweatt Principal Software Analyst Litton / PRC 505.827.9288 *********************** **************************************************************************** *********************************** David J Williams Technical Specialist Information Services F H Faulding & Co Limited Tel: +61 8 8408 3450/ Fax: +61 8 8408 3500 mailto:david.j.williams_at_au.faulding.com <mailto:david.j.williams_at_au.faulding.com> http:www.faulding.comReceived on Tue Jan 04 2000 - 01:00:17 NZDT
This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:40 NZDT