Copying multiple files to a location using wildcard

Hi,
How can I use the copyfile command to copy multiple files of extension '*.csv' to a specific location?
I tried this but it gave errors:
copyfile(fullfile(RawCSVfolder,'*.csv'),ProcessedFoldersDirectory);
Thanks,

1 件のコメント

Sean de Wolski
Sean de Wolski 2012 年 9 月 12 日
What errors? Please post the whole error message.

サインインしてコメントする。

回答 (1 件)

Srinivas
Srinivas 2012 年 9 月 12 日

0 投票

As per the help document
copyfile('Projects/my*','../newProjects/') so it should be
copyfile([RawCSVfolder '\*.csv'],ProcessedFoldersDirectory);
HTH

3 件のコメント

James hall
James hall 2012 年 9 月 13 日
I've tried running this:
for WhichLocation = 1:length(RawCSVfolder);
RawCSVfolder=RawCSVfolder(WhichLocation);
ProcessedFoldersDirectory = ProcessedFoldersDirectory(WhichLocation);
movefile('RawCSVfolder\*ATI*',ProcessedFoldersDirectory)
end
but I'm getting this error:
??? Error using ==> movefile
Argument must contain a string.
Error in ==> AutoMoveRawCSV at 59
movefile('RawCSVfolder\*ATI*',ProcessedFoldersDirectory)
Walter Roberson
Walter Roberson 2012 年 9 月 13 日
What value does ProcessedFoldersDirectory have at that point? Is it possibly the value 0 ? Or possibly a cell string rather than a plain string?
Aadil
Aadil 2012 年 9 月 13 日
yup these should be in curly brackets, made this mistake too many times:
RawCSVfolder=RawCSVfolder{WhichLocation};
ProcessedFoldersDirectory = ProcessedFoldersDirectory{WhichLocation}

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeFile Operations についてさらに検索

質問済み:

2012 年 9 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by