"/bin/mv: Argument list too long" on MacBook

Dear All,

I and my colleague are quite new to resting-state fMRI data analysis, we followed the instructions in the R-fMRI Course V2.1 in our try. We have checked “Functional Connectivity” and “Extract ROI time courses” in DPARSF 4.3, and we used the AAL template with the “Multiple Labels in mask file” option checked. There are 35 subjects in our data.

We encountered an error complaining /bin/mv: Argument list too long at the late stage of data processing:

/bin/mv: Argument list too long

We found that the error is specific to macOS as we have succeeded in processing our data with the same configuration on an Ubuntu 17.10 machine.

According to an answer on stackoverflow, this kind of issue is related to the limit of the ARG_MAX parameter of an OS. While the ARG_MAX value on Ubuntu is 2097152, Mac only typically has a value of 262144, which is considerably less than that on Ubuntu.

The error can be simulated with the following script on a MacBook:

cd /tmp
mkdir argmax_test
cd argmax_test

for i in {1..10000}; do
touch abcdefghijklmnopqrstuvwxyz-$i.txt
done

mkdir dest

# should result in "/bin/mv: Argument list too long"
mv *.txt dest

We have two questions:

  1. Is it possible to make DPARSF to workaround the limit of ARG_MAX? For example, one can move a large number of files by using mv with xargs or find, in which case mv will be called repeatedly for each file.

  2. We found that files starting with “s*” in the FC_FunImgARCWF folder are left in the Results/FC_FunImgARCWF folder (there are 8120 such files) and they were not moved to the ResultsS/FC_FunImgARCWF folder. Is the computation of functional connectivity finished at this stage? Is it possible to move these files manually and continue to analyze the results?

 

Thank you,
Shaoyun

Forums:

1. We may consider this in the future.

2. You can choose those without s*, and do the smooth manually.