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 Exchange에서 File 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