Change directories within a loop

Currently my code looks like this
location='/pathtodata';
copyfile('location','./.')
It keeps trying to copy all folders named location into my directory, not folders from my previously defined location. I am using this in a loop so I want to be able to define the location of the data separately before putting it into my copy file code.
How do I get these files to copy?

1 个评论

Could you confirm that you want to copy folders literally named 'location' ? If so, then what role does your variable that happens to be named location play here?
You want to do that multiple times in a loop? Are the previous location folder that was copied to be removed, or do you want to merge all of the contents into one big directory, or do you want to rename as you go so they end up with separate names like location_0001 location_0002 ?

请先登录,再进行评论。

回答(0 个)

类别

帮助中心File Exchange 中查找有关 File Operations 的更多信息

标签

提问:

2016-11-10

Community Treasure Hunt

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

Start Hunting!

Translated by