dir search multiple files

Hello,
I am using the dir command to search a folder for specific file types. I am looking for both *.jpg and *.png files. How do I structure my statement so that I can search for both file types?

回答 (1 件)

Fangjun Jiang
Fangjun Jiang 2011 年 9 月 19 日

7 投票

Files=[dir('*.jpg');dir('*.png')]

3 件のコメント

Walter Roberson
Walter Roberson 2011 年 9 月 19 日
I think that might be the only option on MS Windows.
On OS-X or Linux there might be an additional more obscure method,
dir('*.{jpg,png}')
This should NOT be expected to work on MS Windows.
Michael
Michael 2014 年 9 月 10 日
I know this is an old link, but it totally saved me. Thanks!
Steve Grobler
Steve Grobler 2018 年 3 月 9 日
helped me too!!

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

カテゴリ

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

タグ

質問済み:

2011 年 9 月 19 日

コメント済み:

2018 年 3 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by