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 件のコメント

Walter Roberson
Walter Roberson 2016 年 11 月 10 日
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 ExchangeFile Operations についてさらに検索

タグ

質問済み:

2016 年 11 月 10 日

コメント済み:

2016 年 11 月 10 日

Community Treasure Hunt

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

Start Hunting!

Translated by