I have a data directory has has three sub-directories and each sub-directory has three different sub-directories. And I need to read two different files from the last sub-directory. How can I accomplish this?
I tried this using the below code and I am not able to navigate through all the sub-directories.
cd $datadir
for dirs in *;
do
cd $dirs
for folders in *;
do
echo $folders;
file1=$(find "$folders" -name '*regADNI.nii.gz');
file2=$(find "$folders" -name '*0.25mm-Crop.nii.gz');
echo $file1
echo $file2
fname=$(echo "$file1" | sed 's|\(.*\)/.*|\1|');
#echo $fname
echo "***************"
done
cd .
pwd
Following is the folder organization
Can anyone help me with this?
Thanks Anandh.