List files not modified for at least 6 days

From: Sabrina Lautier (slautier_at_amadeus.net)
Date: 07/28/04

  • Next message: Tony Howat: "SUMMARY: Solaris as FC SAN client (and multipathing questions)"
    To: sunmanagers@sunmanagers.org
    Date: Wed, 28 Jul 2004 17:19:28 +0200
    
    

    Dear Admins,

    Do you know a way to list files which have not been modified for at least 6
    days ?

    Actually, what I need to do is to clean once a week a directory (/gctmp)
    with files not modified for at least 6 days.

    The following commands would be fine:
    $ find /gctmp/. -mtime +6 -exec rm {} \;
    $ find /gctmp/. -mtime +6 -exec rmdir {} \;
    except that I don't want directory /gctmp/locks to be treated.

    I started writing the following scripts:
    ls /gctmp | egrep -v "^locks$" | while read file
    do
      if [[ -d $file ]]
      then
        find /gctmp/$file -mtime +6 -exec rm {} \;
        find /gctmp/$file -mtime +6 -exec rmdir {} \;
      else
        # What for files under /gctmp not modified for at least 6 days ??
      fi
    done

    But I don't know how to remove files not modified for at least 6 days ?
    Any help will be welcome.

    Regards,
    Sabrina
    _______________________________________________
    sunmanagers mailing list
    sunmanagers@sunmanagers.org
    http://www.sunmanagers.org/mailman/listinfo/sunmanagers


  • Next message: Tony Howat: "SUMMARY: Solaris as FC SAN client (and multipathing questions)"