How to save the textfiles in another paste?

2 vues (au cours des 30 derniers jours)
Daniela Correa
Daniela Correa le 20 Avr 2018
Commenté : Daniela Correa le 20 Avr 2018
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

Réponse acceptée

Rik
Rik le 20 Avr 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')

Plus de réponses (0)

Catégories

En savoir plus sur Environment and Settings dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by