Summary: Shell script needed

From: Frank Langlotz (frala@mem.unibe.ch)
Date: Sat Mar 18 1995 - 16:04:04 CST


My original posting:

>Hi gurus,
>
>I have the following problem:
>In a directory which is mounted by PCs I want to delete all files that are
>older than one week. Sounds like:
>
>find /home/pcfs-m/user/exchange -type f -mtime +7 -exec rm {} \;
>find /home/pcfs-m/user/exchange -type d -mtime +7 -exec rmdir {} \;
>
>doesn't it?
>
>
>However, if a DOS user copies a file which has been created long ago
>and somewhere else into this network directory, it keeps its old creation
>time. So the above script would delete it although it is there since a couple
>of hours only. The "correct" time can be listed with ls -lc. Example:
>
>Today (Mar 15) a PC user copies the file test (creation date Jan 5) to the
>nfs directory. ls -l then shows:
>
>-rwxrwx--- 1 frala aob 283 Jan 5 12:33 test
>
>ls -lc:
>
>-rwxrwx--- 1 frala aob 283 Mar 15 15:23 test
>
>
>Unfortunately there is no way to use the time of last modification of the
>i-node (displayed with ls -lc) as find argument.
>
>Any ideas for a shell script will be appreciated.
>Please mail to me directely, I will assemble the answers and post them.
>
>
>Thanks,
>Frank

Thanks to per@erix.ericsson.se (Per Hedeland), root@netmar.com (Cengiz
Akinli), and elvis@io.com (Elvis Aaron Presley) who sent suggestions.
The find command DOES have a parameter that helps, -ctime +7 does the job.

Frank Langlotz

----------------------------------------------------------------------------
  __________ ___ Frank Langlotz
  \ \ / / University of Bern
   \_\___ / / M. E. Mueller Institute for Biomechanics
    \ \ / / P.O.Box 30
     \_\ /_/________ CH-3010 Bern
----------------------------------------------------------------------------
phone: +41-31-632-8679 fax: +41-31-632-4951
e-mail: frala@mem.unibe.ch WWW: http://cranium.unibe.ch/~frala
----------------------------------------------------------------------------



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:10:19 CDT