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 (instead of using the GUI) and you can use `Get` instead of `Import`, and `Do` instead of `Table`. You could also filter out files you don't want before importing, if this is desirable.