필터 지우기
필터 지우기

How to save the textfiles in another paste?

조회 수: 2 (최근 30일)
Daniela Correa
Daniela Correa 2018년 4월 20일
댓글: Daniela Correa 2018년 4월 20일
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개)

카테고리

Help CenterFile Exchange에서 Text Files에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by