How to copy files form one directory to another

21 次查看(过去 30 天)
Hi,
I want to copy all files from one folder to another folder. How can I do this using arrayfunc ?
sorce_folder files:
s1.csv
s2.csv
s3.txt
and destination_folder:
d1.csv
d2.txt
d3.txt
I want to copy all the files in source_folder to destination_folder using arrayfun.
  1 个评论
Stephen23
Stephen23 2020-2-5
Do the files have to be renamed as well as moved? If renaming is not required you could probably do this with one command.

请先登录,再进行评论。

回答(1 个)

Stijn Haenen
Stijn Haenen 2020-2-5
cd('source_folder')
filenames=dir;
for i=3:length(filenames)
copyfile(filenames(i).name,'destination_folder')
end

类别

Help CenterFile Exchange 中查找有关 Adding custom doc 的更多信息

标签

产品


版本

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by