Hi, Johannes-
OK, from the error, I suspect that is a shell scripting issue, that the value after "-input ..." in the command should not be "$FLAIR", but instead "$t1", as the latter seems to have the full path information and the former just part of the file name.
So, could you please try the following:
for folder in /Users/lab/Desktop/MRI/*/
do
echo $folder
id=$(basename "$folder")
echo $id
t1="$folder"*"FLAIR"*".ni"*
echo $t1
mkdir /Users/lab/Desktop/MRI/$id/
/Users/lab/abin/@afni_refacer_run -input "$t1" -mode_reface -anonymize_output -prefix /Users/lab/Desktop/MRI//$id/"$id"_FLAIR_reface.nii.gz
done
echo 'done with script'
... and see how that goes?
--pt