filesep and move contents
Afficher commentaires plus anciens
Hello, I have two folders. both contain some subfolders, and their subfolders also contain subfolders.
abc1 >> sdir1 >> ab1 >> file1.txt
abc1 >> sdir2 >> ab1 >> file2.txt
abc1 >> 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?
Réponse acceptée
Plus de réponses (1)
YOGESH
le 19 Oct 2011
Catégories
En savoir plus sur Structures dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!