how to create new folder ?

How to create a new folder ? if the folder already exist , the program will add another new folder. for example, i want to create a folder named 'Image' , if the 'Image' folder already exist, program will create another folder name 'Image1' .

回答 (1 件)

Stephen23
Stephen23 2018 年 4 月 13 日
編集済み: Stephen23 2024 年 11 月 4 日

0 投票

You could download my FEX submission nextname:
It will return the next unused file/folder name, which you can then simply use with mkdir. Each time you need a new directory simply call it with e.g.:
subd = 'absolute or relative path to where the folders are';
name = nextname(subd,'Image<1>',true);
mkdir(name)

1 件のコメント

Stephen23
Stephen23 2018 年 4 月 13 日
編集済み: Stephen23 2018 年 4 月 13 日
@afiqa yazid: my answer shows you exactly how you need to use it. I recommend that you read the Examples tab on the FEX page too.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeDownloads についてさらに検索

質問済み:

2018 年 4 月 13 日

編集済み:

2024 年 11 月 4 日

Community Treasure Hunt

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

Start Hunting!

Translated by