Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

dir function help

Asked by James on 6 Aug 2011


I want to be able to list all the jpg files within a folder called videos. Can anyone explain why my code does not work:


I get the error videos/*.jpg not found. Please help


Image Analyst on 6 Aug 2011

Well you're missing a trailing quote, but that won't give that error. Did you follow the guidelines for the second example of this section of the FAQ:

Jan Simon on 7 Aug 2011

@James: Please post a copy of the complete error message.



No products are associated with this question.

3 Answers

Answer by Paulo Silva on 6 Aug 2011

perhaps the bar is the other one?


1 Comment

Pierre on 6 Aug 2011

'/' as file separator should also work on Windows systems too. (At least it does on mine.)

Paulo Silva
Answer by Fangjun Jiang on 6 Aug 2011

1 Comment

Pierre on 6 Aug 2011

(Just for convenience issues: fullfile('videos', '*.jpg') is equivalent to your statement and comes in quite handy for deeper stacked directory structures.)

Fangjun Jiang
Answer by Pierre on 6 Aug 2011
  • Are you in the right working directory? Check with pwd and/or check whether the results of dir (without any parameters) contains a directory called "videos".
  • If there is no file matching the pattern, this error will appear. You won't simply get an empty result (although I agree this should be the case).
  • Did you eventually forget about the case sensitivity of Linux systems?



Contact us