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

ark86 01-28-2006 09: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 01: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 02: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 08:16 AM.