public void go() {

		FileWriter fw = null;

		try {
			File dir = new File(dirname);
			fw = new FileWriter(output);
			BufferedWriter bw = new BufferedWriter(fw);

			File[] fa = dir.listFiles(new EndsWithFilter(extension));

			for (File f : fa) {

				String name = f.getName();
				int start = name.indexOf(separator);
				int end = name.lastIndexOf(extension);
				String substr = name.substring(start + 1, end);
				int polynum = Integer.parseInt(substr);

				if (polynum >= min && polynum <= max) {

					FileReader fr = new FileReader(f);
					BufferedReader br = new BufferedReader(fr);

					String ln = br.readLine();
					if (headerWrite) {
						bw.write("SOURCE\t" + ln + System.getProperty("line.separator"));
						headerWrite = false;
					}
					ln = br.readLine();
					while (ln != null) {
						bw.write(substr + "\t" + ln + System.getProperty("line.separator"));
						ln = br.readLine();
					}
					br.close();
					fr.close();
				}
				System.out.println("File " + f.getName() + " processed.");
			}
			
			bw.flush();
			bw.close();

		} catch (IOException e) {
			System.out.println("Error accessing output file: " + output);
			e.printStackTrace();
		} finally {
			if (fw != null) {
				try {
					fw.close();
				} catch (IOException e) {
					// TODO Auto-generated catch block
					System.out.println("ERROR: " + output + " could not be closed properly.");
					e.printStackTrace();
				}
			}
		}
		
		File ofile = new File(output);
		
		if(ofile.length()==0){
			System.out.println("\nWARNING: " + output + " length is 0\n");
		}

	}