I am trying to automate a process which take a file type NIFTI, preprocess it, and places the new processed file in an output folder.
deepbrain-extractor -i <input-dir> -o <output-dir>
I wrote this bash script to automate this process for all files in a directory:
for file in path/*.nii
do
deepbrain-extractor -i $file -o path/newfiles
done
The problem is every time the code runs, it overwrites the old files (since all automatically get the same name). Is there a way to prevent that?
deepbrain-extractorthat defines what happens topath/newfiles.path/newfilesto be different for each input file? What behavior do you want to happen, instead of the behavior you actually get?deepbrain-extractor -i "$file" -o "${file%.nii}.out"(and this question would be a duplicate of ones already in our knowledge base).