copyfile

Copies all the files in a directory and all of its subdirectories

You are now following this Submission

Copies all the files in a directory and all of its subdirectories and places the results in a new folder.
% [list,numfiles] = copyfile(ext,copypath,pastepath);
% written by Joseph Hollmann, April 2011
% created to copy all files of a given type from one directory and all of its
% subdirectories. Places all files in a new directory
% Input:
% ext - file extension to be copied (i.e. 'm' for m-files)
% pathname - directory to be searched
% Outputs:
% list - all the filenames with srchwrd
% numfiles - number of files in list

% persistent copypath pastepath; % allows the same path to be utilized several times
% copypath - path files exist
% pastepath - path to copy files to

Cite As

Joseph Hollmann (2026). copyfile (https://www.mathworks.com/matlabcentral/fileexchange/39182-copyfile), MATLAB Central File Exchange. Retrieved .

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.0.0.0