Hello, I have two folders. both contain some subfolders, and their subfolders also contain subfolders.
abc1 >> sdir1 >> ab1 >> file1.txtabc1 >> sdir2 >> ab1 >> file2.txtabc1 >> sdir3 >> ab1 >> file3.txt|and|xyz2 >> sdir1 >> xyz2 >> sdir2 >> xyz2 >> sdir3 >>
Ok, Now I want to go in abc1, into sdir1 and move everything to xyz2 into sdir1 next, change to folder abc1 into sdir2 and move everything to xyz2 into sdir2. I want to do in a for loop, and i tried something like this
cd D:\abc1\;dir = dir;list1 = dir(3:end);% check whether the folder (sdir1,2..)me name exists
for i = 1:length(list1) if (exist (fullfile 'D:','xyz2','list1(i)')) disp 'folder exists...' continue else stop disp 'folder doesnt exist...' end cd (list1{i}) mv '*' (fullfile('D:','xyz2','list1(i)')); cd ../; end
any idea how I can do this?
Best Answer