Posted By

Shocm on 10/14/08


find shred

Versions (?)

Find and Shred

 / Published in: Bash

Command to search for a file type, in the case of the example any ending with .sql in the name, that is last modified over a certain time (45 days in example), and shred that file

Use command with extreme caution, suggest running "find /path/to/start/search -name "*.sql" -mtime +45 -print" first to verify the files that are going to be shred before actually running this command. There is no undo from BASH shred :-)

  1. # Suggestion, first run the 'print' command to preview which files are going to be shredded
  2. find /path/to/start/search -name "*.sql" -mtime +45 -print
  4. # When you are comfortable with what you have you can shred
  5. find /path/to/start/search -name "*.sql" -mtime +45 | xargs shred -fuvz

Report this snippet  

You need to login to post a comment.