Artificial intelligent assistant

Loop through all files in a given subdirectory, name the output by the looped file I have thousands of *csv files in a certain subdirectory. There's a simple in line executable which I use to work with these files, which I pipe into a new file: executable file1.csv standard.csv > output_file1.csv I would like to create a for loop to do this not just for `file1.csv`, but for all files in that subdirectory. I would try something like this: for file in *.csv do # run executable on "$file" and output executable $file standard.csv > output done I think this will work, but how do I name each output `output_` \+ `$file` +`.csv`?

Credit to Bruno9779 for the original draft of this answer. Not sure why it was self-deleted, as it was a pretty good answer:

You have pretty much done it yourself:


destinationDir="/destination/path/here/"
if cd "$destinationDir"; then
for file in *.csv; do
# run executable on "$file" and output
executable "$file" standard.csv > "${destinationDir}/output_${file}.csv"
done
else
echo "Unable to change to working directory."
fi


Just remember to quote filenames with variables.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 5751558410b4fe421fc03d43288f7bb8