List of utility methods to do File Name Get
String | getFileName(String folder, final String path) get File Name File dir = new File(folder); String[] list = dir.list(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.contains(path); }); if (list.length == 0) { ... |
String | getFilename(String fullFilename) Get filename from full path. int pos = fullFilename.lastIndexOf(File.separatorChar); return fullFilename.substring(pos + 1); |
String | getFileName(String localRootDirName, String ending) get File Name File folder = new File(localRootDirName); File[] listOfFiles = folder.listFiles(); int i = 0; for (i = 0; i < listOfFiles.length; i++) { if (listOfFiles[i].getName().indexOf(ending) >= 0) break; if (i == listOfFiles.length) ... |
String | getFileName(String name) get File Name if (new File(name).exists()) { return name; if (System.getProperty("os.name").contains("Mac")) { try { String appBundle = (String) Class.forName("com.apple.eio.FileManager") .getMethod("getPathToApplicationBundle", (Class[]) null).invoke(null, (Object[]) null); if (new File(appBundle + "/Contents/Resources/Java/" + name).exists()) { ... |
String | getFileName(String originPath) Get the file name, given a complete path. String file = ""; try { file = originPath.substring(originPath.lastIndexOf(File.separatorChar) + 1); } catch (Exception e) { e.printStackTrace(); return file; |
String | getFileName(String path) get File Name String filename = path; if (filename.contains(File.separator)) { filename = filename.substring(filename.lastIndexOf(File.separatorChar) + 1); return filename; |
String | getFilename(String path) get Filename int pos = path.lastIndexOf(File.separator); return path.substring(pos + 1, path.length()); |
String | getFileName(String path) get File Name int separatorIndex = path.lastIndexOf(File.separator); return (separatorIndex < 0) ? path : path.substring(separatorIndex + 1, path.length()); |
String | getFilename(String path) get Filename List<String> list = Splitter.on(File.separator).splitToList(path);
return list.get(list.size() - 1);
|
String | getFileName(String path) Gets the file name. int mid = path.lastIndexOf(FILE_PATH_SEPARATOR); return path.substring(mid + 1, path.length()); |