MATLAB: Dir function is creating additional files while creating a structure? how to ignore it

dirMATLAB

Im trying to make a loop that reading all the files in a choosen folder, I use the dir function to make list of the names of the files and to iterate this list:
files = dir('folder');
for k =1:length(files)
I = imread(files(k).name);
But there is always an error:
Error using imread (line 347)
Cannot open file "." for reading. You might not have read permission.
When I open my structure named "files" there is 2 new rows that the dir function creates in addition to all the other files in that structure:
the first file named '.' and the second '..', those files not exist in the original folder, what to do to erase them or ignore them permanently?

Best Answer

Do a more specific search, like
files = dir('folder/*.jpg');
Or, just throw the first 2 away
files = dir('folder');
files(1:2)=[];