-   Linux - Newbie (
-   -   Recursively traversing sub-directories (

ark86 01-28-2006 08:33 PM

Recursively traversing sub-directories
What I need to do is recursively traverse some sub-directories, and perform an operation on each file in that subdirectory. More specifically I need to run the specified command on each file and have the output put in the same directory. This is what I have so far:

find . -name *.class -exec jad {} \;

This works fine except that the ouput file that jad generates is put in the directory that I run the command from, whereas I need the output to be in the directory where the corresponding file resides. I would appreciate any help. Thanks in advance.

frob23 01-29-2006 12:00 AM


find . -name *.class -execdir jad {} \;
Which does the same thing but only after changing to the directory the file is in.

ark86 01-29-2006 01:15 PM

Thanks, that worked perfect. I have to do it on my mac instead of my gentoo box (different versions of find), but I got it to work.

All times are GMT -5. The time now is 11:02 PM.