Taking from the last answer (by im3r3k) here: How do I recursively shred an entire directory tree?
I'm trying to get the find
command to call a shell script as described.
So far I've tried:
find /home/shredtest/* -depth -exec /home/test.sh {}\;
where /home/shredtest
is the directory whose contents I want to shred (but without removing /home/shredtest
itself and where /home/test.sh
is the script to run. I did chmod +x /home/test.sh
.
The find
command above returns:
find: -exec CMD must end by ';'
I've also tried:
find /home/shredtest/* -depth -exec /home/test.sh "{}"\;
find /home/shredtest/* -depth -exec /home/test.sh {}\;
find /home/shredtest/* -depth -exec sh /home/test.sh "{}"\;
find /home/shredtest/* -depth -exec sh \/home\/test.sh {}\;
find /home/shredtest/* -depth -exec sh \/home\/test.sh "{}"\;
all of which return the same error.
So:
- Why is the
-exec
failing to see the semicolon? Obviously it's there and escaped so something else must be wrong. I just don't see it. - Am I even going about this the right way or is there a better way to achieve this?
find /home/shredtest/*
I found, by running the find by itself, that without the trailing * the shredtest directory itself is included in the results. With the trailing * it's not. Is this not the right way or is there a better way to exclude shredtest from being shreded? – JoelAZ Jul 04 '14 at 04:54-mindepth 1
to process only contents and not the command-line arguments themselves. – Michael Homer Jul 04 '14 at 04:59