import java.io.*;

/**
 * This class acts like the 'dir' command line program.
 * It just lists all the files in the directory supplied.
 *
 **/

public class dir {

	public static void main(String[] args) {

		if (args.length == 0) {
			System.out.println("USAGE: java dir [file]");
			System.exit(0);
		}

		// This does not throw any exceptions because it does
		// not require that the named file exists.
		File f = new File(args[0]);

		if (!f.exists()) {
			System.out.println("File does not exist");
			System.exit(0);
		}

		if (!f.isDirectory()) {
			System.out.println("File must be a directory.");
			System.exit(0);
		}

		String[] list = f.list();

		for(int i=0; i<list.length; i++)
			System.out.println(list[i]);

	}
}