List of utility methods to do File Move
File | move(File file, File directory) Moves file into directory. Check.arg().validFile(file); Check.arg().validDirectory(directory); return rename(file, new File(directory, file.getName())); |
boolean | move(File source, File destination) move if (!source.exists()) { return false; destination.delete(); return source.renameTo(destination); |
boolean | move(String sourceFileName, String destinationFileName) move return move(new File(sourceFileName), new File(destinationFileName)); |
void | moveFile(String sourceFileName, String destPath) move File File src = new File(sourceFileName); if (!src.exists()) { throw new Exception("save file[" + sourceFileName + "] to file[" + destPath + "] failed:" + sourceFileName + " not exist."); try { FileUtil.fileCopy(sourceFileName, destPath); ... |
void | moveSubFiles(String sourceFileName, String destPath) move Sub Files File src = new File(sourceFileName); File dest = new File(destPath); if (!dest.exists()) dest.mkdirs(); if (src.isFile()) return; else { File[] files = src.listFiles(); ... |
void | move(String input, String output) This class moves an input file to output file File inputFile = new File(input); File outputFile = new File(output); try { inputFile.renameTo(outputFile); } catch (Exception ex) { throw new Exception("Can not mv" + input + " to " + output + ex.getMessage()); |
void | moveFile(File source, File target) move File Process p = Runtime.getRuntime().exec( new String[] { MOVE_COMMAND, source.getAbsolutePath(), target.getAbsolutePath() }); try { int ret = p.waitFor(); if (ret != 0) throw new IOException("Failed to move " + source.getAbsolutePath() + " to " ... |
void | moveFile(File src, File dest) Moves a file from src to dest. copyFile(src, dest); if (!delete(src)) { throw new IOException("Failed to delete the src file '" + src + "' after copying."); |
String | moveFile(String in, String out) Moves a file, overwriting any existing file at the destination. copyFile(in = assertNotEmpty("in", in), out); delete(in); return out; |