in reply to Read entire file from given folder
Also note that you may want to change the regexp /^\.\.?$/ to /^\.\.?\z/ so that it doesn't match a filename consisting of a dot an a newline.