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,

Réponses (1)

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

3 commentaires

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)
What value does ProcessedFoldersDirectory have at that point? Is it possibly the value 0 ? Or possibly a cell string rather than a plain string?
yup these should be in curly brackets, made this mistake too many times:
RawCSVfolder=RawCSVfolder{WhichLocation};
ProcessedFoldersDirectory = ProcessedFoldersDirectory{WhichLocation}

Connectez-vous pour commenter.

Catégories

En savoir plus sur File Operations dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by