Processing File Directories
===

I am writing a program which reads in files and then processes them. At the moment, I am using a BufferedReader to read in a list of files from a txt file. This txt file was generated in a command prompt from doing:

    dir > filelist.txt

and then cropping down this to just the filenames. 

I can incorporate this into my script by:

    //pseudo code(needs further directory specification)
    Runtime run = Runtime.getRuntime();//pseudo code(needs further directory specification)
	Process process = run.exec("dir > filelist.txt");

This command gives the directory with files in the form:

    dd/mm/yyyy hh:mm       (filesize) file

Once I have this file I can run a Regex to extract the filename.

    Pattern file = Pattern.compile("(\d){2}/(\d){2}/(\d){4}\s(\d){2}(:)(\d){2}\s(\d+)\s(.+)\.txt");
	
	for (String fileline : filelist) {
		Matcher matchfile = file.matcher(fileline);
		if(matchfile.find()){
			filearray.add(matchfile.group().split("\\s")[3]);
		}
	}

My question is, is there an easier way to get just the file names from a directory within a Java script? This seems a bit long winded.