Bash script for running a python script in each subdirectory
This shell script which is developed to batch process simulation results, runs a python script in each subdirectory of a parent folder.
storeDir="processedData"
pyFile="dataExtract.py"
if [ -d "$storeDir" ]; then
rm -Rf "$storeDir"
fi
for dir in A*/; do
cp "$pyFile" "$dir"
cd "$dir"
python3 "$pyFile"
rm "$pyFile"
cd ..
done
mkdir "$storeDir"
mv A*.dat "$storeDir"
echo "Files are moved to $storeDir."
echo "Done..."