Move Files from different folder into one.
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi,
New on matlab, i'm trying to find a way to move several files with the same 4 first letters from 4 different folder with the same first 4 letter into one.
My Files are name f100 .... and my folder Run... (with 4 random digits after "Run").
I've tried this code
movefile C:\Users\80CDGZ1\Documents\Data_EXCOG\EC01\Run1\Run*\f100* C:\Users\80CDGZ1\Documents\Data_EXCOG\EC01\Run1\Run1
But it's not working, does any of you have an idea ?
Thank's a lot
Theophane.
5 Kommentare
Antworten (2)
Ruger28
am 4 Feb. 2020
actually, I like this one better --> rdir
MainDirectory = 'C:\Users\80CDGZ1\Documents\Data_EXCOG\EC01\Run1'
EndDirectory = 'C:\Users\80CDGZ1\Documents\Data_EXCOG\EC01\Run1\Run1'
Files2Move = rdir(fullfile(MainDirectory,'**\*.nifti '));
for ii = 1:length(Files2Move)
currentfile = fullfile(Files2Move(ii).folder,Files2Move(ii).name);
movedfile = fullfile(EndDirectory,Files2Move(ii).name);
movefile(currentfile,movedfile); % move files
end
Image Analyst
am 4 Feb. 2020
See the FAQ: Process a sequence of files
Basically make up two filenames in the loop and call movefile
sourceFileName = fullfile(.......
destinationFileName = sprintf(.........
movefile(sourceFileName, destinationFileName);
Siehe auch
Kategorien
Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!