One way to go about this is read in the file names - this way you don't have to explicitly check to see if they exist. path = SystemDialogInput["Directory", NotebookDirectory[]]; fileNames = FileNames["*.txt", path]; allFiles = Table[Import[fileNames[[num]]], {num, 1, Length[fileNames]}]; Of course you could specify the directory name in the code (instad of using the GUI) and you can use `Get` instead of `Import`.