How to copy files form one directory to another

36 visualizaciones (últimos 30 días)
Mekala balaji
Mekala balaji el 5 de Feb. de 2020
Comentada: Stephen23 el 5 de Feb. de 2020
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 comentario
Stephen23
Stephen23 el 5 de Feb. de 2020
Do the files have to be renamed as well as moved? If renaming is not required you could probably do this with one command.

Iniciar sesión para comentar.

Respuestas (1)

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

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by