List of utility methods to do File Name Get
String | getFileNameInJCCTrayHome(String fileName) get File Name In JCC Tray Home return getFileName(JCCTRAY_HOME, fileName);
|
String | getFileNameList(File[] files) returns list of files as string, comma separated. String list = ""; String listSep = ","; for (int i = 0; i < files.length; i++) { if (files[i].isFile()) { list += (files[i].getName() + listSep); return list.substring(0, list.length() - 1); ... |
List | getFileNameList(String dir) Get file name list under a directory List<String> fileNameList = new ArrayList<String>(); File _dir = new File(dir); File[] files = _dir.listFiles(); if (files != null) { for (int i = 0; i < files.length; i++) { if (files[i].isFile()) { String fileName = files[i].getName(); fileNameList.add(fileName); ... |
ArrayList | getFileNameList(String path) get File Name List File file = new File(path); File[] tempList = file.listFiles(); ArrayList<Integer> tnames = new ArrayList<Integer>(); ArrayList<String> names = new ArrayList<String>(); for (int i = 0; i < tempList.length; i++) { if (tempList[i].isFile()) { tnames.add(Integer.valueOf(tempList[i].getName())); Collections.sort(tnames); for (int i = 0; i < tnames.size(); i++) { names.add(tnames.get(i) + ""); if (names.size() == 0) names.add("-1"); return names; |
String | getFileNameNoSuffix(String fullName) get File Name No Suffix String name = (new File(fullName)).getName(); if (name.lastIndexOf('.') > -1) { return name.substring(0, name.lastIndexOf('.')); } else { return name; |
String | getFileNameNoSuffix(String path) Get just the file name without a suffix from a path return getFileNameNoSuffix(new File(path)); |
String | getFileNameOfPath(final String filePath) get File Name Of Path final int lastIndexFileSep = filePath.lastIndexOf(File.separator); return filePath.substring(lastIndexFileSep + 1); |
String | getFilenameOnly(File file) Get the file name with the dot and extension stripped off. String filename = file.getName(); if (filename.contains(".")) { return filename.substring(0, filename.lastIndexOf(".")); return null; |
String | getFileNameOnly(String fileName) get File Name Only int index = -1; String auxString = fileName, returnedValue = null; index = fileName.lastIndexOf(File.separator); if (index == -1) index = fileName.lastIndexOf('/'); if (index != -1) auxString = fileName.substring(index + 1); index = auxString.lastIndexOf('.'); ... |
String | getFileNameOnlyFromFileObject(File fileToProcess) get File Name Only From File Object String result = fileToProcess.getAbsolutePath(); int index = result.lastIndexOf("/"); if (index == -1) { index = result.lastIndexOf("\\"); if (index != -1 && (index + 1) < result.length()) { result = result.substring(index + 1); return result; |