import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Arrays; import gnu.getopt.Getopt; class DosLikeTreeCoreCode { private String filepath; public boolean dontShowHiddenFiles = false; DosLikeTreeCoreCode() { filepath = "."; } DosLikeTreeCoreCode(String arg) { filepath = arg; } private String convertToSanePath(String arg) { String path; if(!filepath.endsWith("/")) return (path = filepath + "/" + arg); else return (path = filepath + arg); } private boolean isDirectory(String arg) { String path = convertToSanePath(arg); File f = new File(path); if(f.isDirectory()) return true; else return false; } private boolean isHidden(String arg) { String path = convertToSanePath(arg); File f = new File(path); if(f.isHidden()) return true; else return false; } public void listDirectoryContents() { System.out.println(filepath); File f = new File(filepath); String[] filelist = f.list(); List directories = new ArrayList(); List files = new ArrayList(); int longestName = 0; int spacing = 0; Arrays.sort(filelist); for(int i=0;ilongestName&&!isHidden(filelist[i])) longestName = filelist[i].length(); if(isDirectory(filelist[i])&&!isHidden(filelist[i])) directories.add(filelist[i]); else if(!isHidden(filelist[i])) files.add(filelist[i]); } for(int i=0;i"); System.out.println(); } for(int i=0;i