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 ...
- 11-07-2008 #1Just Joined!
- Join Date
- Nov 2008
- Posts
- 1
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:
These are just samples; but you get the idea.Code:find /tmp/ -type f -ctime +30 -exec rm {}\; find /tmp/ -type d -ctime +30 -exec rm -r {}\;
- 11-07-2008 #2Linux 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"


Reply With Quote