The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 -->
  #2 (permalink)  
Old 06-13-2005
zazzybob's Avatar
zazzybob zazzybob is offline Forum Advisor  
Registered Geek
  
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
There is no way in Unix to get a files creation time. You can find a files modification time, mtime, (you have ctime - the time when a files status was changed - check out the find man page), and if you can guarantee the file has not been modified since it was created, you have your creation time.

Anyway, the -regex looks to be an overcomplication.

find / ! -name "*.log" -mtime 45 | xargs shred -fuvz

If this doesn't work, chances are the files would have been modified after creation.

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.

Cheers
ZB

Last edited by zazzybob; 06-13-2005 at 10:34 AM..