How to save the textfiles in another paste?

2 views (last 30 days)
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

Accepted Answer

Rik
Rik on 20 Apr 2018

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')

More Answers (0)

Categories

Find more on Environment and Settings in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!