The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 06-13-2005
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,131
Quote:
Originally Posted by cbismuth
I need to find all the files which not end by ".log" and which have been created for 45 days.
After getting the file list, I would like to use the shred command.
Quote:
Originally Posted by zazzybob
find / ! -name "*.log" -mtime 45 | xargs shred -fuvz

EDIT; if running this as root, and some important system files were modified 45 days ago, you are staring into the eyes of doom with a command like that.

Do a
find / ! -name "*.log" -mtime 45 -print
to see the output before adding the "destructive" pipe through to xargs shred.
I think it's actually worse than you think, ZB. Since the OP used the the past perfect tense, I would read that as:
... -mtime +44 ... # (I could not bring myself to type such a dangerous command in its entirety)

Destroy all files older than 45 days except for log files and a few newer files.

I can believe an attempt to destroy all files, but trying to leave stuff behind is weird. In any event shredding /dev/mem or /dev/kmem will panic the system for sure. But I doubt the command will get that far. We need some clarification here.