How to save the textfiles in another paste?

2 次查看(过去 30 天)
Hello, I have this rotine, and I want to save the textfiles in another paste.
mainFolder = uigetdir('C:\Users\Dani\Documents\PORTUGAL\Error_Sims'); % Select your Main folder
[~,message,~] = fileattrib([mainFolder,'\*']);
fprintf('\n There are %i total files & folders.\n',numel(message));
allExts = cellfun(@(s) s(end-2:end),{message.Name},'uni',0);% Get file ext
TXTidx = ismember(allExts,'txt');% Search extensions for "CSV" at the end
TXT_filefolders = {message(TXTidx).Name}; % Use idx of TXTs to list paths.
fprintf('There are %i files with *.txt file ext.\n',numel(TXT_filefolders));
for ii = 1:numel(TXT_filefolders)
movefile(['(TXT_filefolders(ii)', 'C:\Users\Dani\Documents\PORTUGAL\Pasta_Erros','f'])
end
But I have the Error : Error using movefile No matching files were found.
How I can save it ? The TXT_filefolders is a cell

采纳的回答

Rik
Rik 2018-4-20

Without actually having delved through your code, you could try the modification below.

movefile(TXT_filefolders{ii}, 'C:\Users\Dani\Documents\PORTUGAL\Pasta_Erros','f')

更多回答(0 个)

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by