Recursively loop through directories and run a command on a file in the directory
I’m not 100% solid on how JAD works exactly, but based on the info I found in this README file, this find
command should give you a start:
find . -type f -name '*.class' |\
while IFS= read -r java_class_path
do
java_dirname=$(dirname "${java_class_path}")
jad -sjava -d"${java_dirname}" "${java_class_path}"
done
The -s
option will set the output extension to .java
and the -d
sets a destination directory for file output based on where the original .class
file was found via find
. The key to solving problems like this is to understand you are not the first person who wanted to output command line output to another destination.