How to copy files but not folders from one folder to destination?
20 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Zhangxi Feng
el 1 de Jul. de 2019
Respondida: Zhangxi Feng
el 1 de Jul. de 2019
Not sure why I am having difficulty searching for this but all the questions I found were just about copying specific file or specific patterns of files.
Is there a quick way to ask copyfile to copy only the files but not the folders that may also be in the directory to a destination directory?
Thanks!
Jesse
2 comentarios
dpb
el 1 de Jul. de 2019
Not by itself, no...it's not that smart.
Couple ways to work around limitations; probably simplest in Matlab alone is to use dir('*.*') and iterate over the contents checking each entry is not a directory before passing to copyfile.
Another job really best to pass to the underlying OS with appropriate switches to whatever command is appropriate for the OS you're using.
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre File Operations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!