Find the answer to your Linux question:
Results 1 to 2 of 2
Here's the deal. I'm in a SunOS, Irix, and linux environment. I'm trying to delete all the files in /tmp and /var/tmp that ARE NOT lock or socket files and ...
  1. #1
    Just Joined!
    Join Date
    Nov 2008
    Posts
    1

    Unhappy Delete all files in /tmp except lock and socket files

    Here's the deal. I'm in a SunOS, Irix, and linux environment. I'm trying to delete all the files in /tmp and /var/tmp that ARE NOT lock or socket files and are more that 30 days old. So far I got this:

    Code:
    find /tmp/ -type f -ctime +30 -exec rm {}\;
    find /tmp/ -type d -ctime +30 -exec rm -r {}\;
    These are just samples; but you get the idea.

  2. #2
    Linux Newbie
    Join Date
    Jul 2008
    Posts
    181
    Depending on how you can identify lock files, something like this:

    Code:
     find /tmp -not -type s -not -name "*.lock"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...