/** * �õ�ϵͳ���õ��ϴ��ļ�����·�� * * @return String */ public static String getPath(String loadPath) { String path = PropertiesReader.GetProptery(loadPath); if (path == null || "".equals(path)) { throw new java.lang.IllegalStateException("�ϴ��ļ��ı���·��û�����á�" + loadPath + "=?"); } File file = new File(path); if (!file.isDirectory()) { file.mkdirs(); } return path; }
public static String[] get_filelist(String path, boolean nodirs, boolean nofiles) { File folder = new File(path); if (folder.isDirectory()) { File[] listOfFiles = folder.listFiles(); java.util.Vector<String> r = new java.util.Vector<String>(); for (int i = 0; listOfFiles != null && i < listOfFiles.length; i++) { if ((listOfFiles[i].isFile() && !nofiles) || (listOfFiles[i].isDirectory() && !nodirs)) { r.add(listOfFiles[i].getName()); } } return r.toArray(new String[0]); } else { return null; // A: no existe o no es directorio } }
/* * �������µ��ļ�·���ַ� */ private static String getAbstractPath(String path) { Calendar cl = Calendar.getInstance(); int year = cl.get(Calendar.YEAR); int month = cl.get(Calendar.MONTH); StringBuffer buffer = new StringBuffer(); buffer.append(year); buffer.append("/"); month++; if (month < 10) { buffer.append(0); } buffer.append(month); buffer.append("/"); File renameTo = new File(path + buffer.toString()); if (!renameTo.isDirectory()) { renameTo.mkdirs(); } return buffer.toString(); }