In Windows, the dir command will usually return the first two values as dots, not a file name. When I run this code:
fnames = dir;
the first two values for ‘folder’ are:
See if setting your for loop to begin at 3 instead will help:
You have not stated the error, so this is a guess as to what the problem actually is.