I have the following file/directory structure:
tsunami # find .
.
./dir1
./dir1/dirinner
./dir1/dirinner/innerfile
./logs
./messages
I am trying to recursively find files and process them using find/exec.
The version of find (comes with busybox) does not allow the use of the discovered file name more than once in the exec command like discussed here. So, I used one of the suggested solutions. So, I re-wrote this:
find * -type f -exec echo {} +
to this:
find * -type f -exec sh -c 'echo $0' {} +
But the new version find the innermost file only, and nothing else.
Here is the output for both:
tsunami # find * -type f -exec echo {} +
dir1/dirinner/innerfile logs messages
tsunami # find * -type f -exec sh -c 'echo $0' {} +
dir1/dirinner/innerfile
How do I fix this? I need it to find all files, not just the inner most one.
-exec
clause? You will list all files withfind . -type f
.