private String moveFile(String filename, String dest) throws BaseException { if (!directoryExists(dest)) throw new BaseException("Could not find or create directory \"" + dest + "\""); File srcFile = new File(filename); String destFilename = dest + "/" + srcFile.getName(); File destFile = new File(destFilename); if (!srcFile.renameTo(destFile)) throw new BaseException("Could not move file \"" + filename + "\" to \"" + dest + "\""); return destFilename; }
public Mp3Move(String filename, String destination) { try { if (!directoryExists(destination)) throw new BaseException("Destination directory \"" + destination + "\" cannot be found"); String dest = makeDirectory(filename, destination); String destFilename = moveFile(filename, dest); printOut(destFilename); } catch (BaseException e) { printError("ERROR processing \"" + FileUtils.extractFilename(filename) + "\" - " + e.getDetailedMessage()); } catch (Exception e) { printError("ERROR processing \"" + FileUtils.extractFilename(filename) + "\" - " + formatExceptionMessage(e)); } }
protected Mp3Pics(String filename) { try { mp3file = new Mp3File(filename); extractPics(); } catch (BaseException e) { printError("ERROR processing " + FileUtils.extractFilename(filename) + " - " + e.getDetailedMessage()); } catch (Exception e) { printError("ERROR processing " + FileUtils.extractFilename(filename) + " - " + formatExceptionMessage(e)); } }
protected Mp3Catalog(String filename) { try { mp3file = new Mp3File(filename); catalog(); } catch (BaseException e) { printError("ERROR processing " + FileUtils.extractFilename(filename) + " - " + e.getDetailedMessage()); } catch (Exception e) { printError("ERROR processing " + FileUtils.extractFilename(filename) + " - " + formatExceptionMessage(e)); } }
protected Mp3Details(String filename) { try { mp3file = new Mp3File(filename); show(); } catch (BaseException e) { printError("ERROR processing " + FileUtils.extractFilename(filename) + " - " + e.getDetailedMessage()); } catch (Exception e) { printError("ERROR processing " + FileUtils.extractFilename(filename) + " - " + formatExceptionMessage(e)); } }
protected void renameFile(String filename, String newFilename) throws BaseException { if (! filename.equals(newFilename)) { File originalFile = new File(filename); File renamedFile = new File(newFilename); if (renamedFile.exists()) { throw new BaseException("File with destination name \"" + FileUtils.extractFilename(newFilename) + "\" already exists"); } originalFile.renameTo(renamedFile); } }
printError("ERROR processing \"" + FileUtils.extractFilename(filename) + "\" - " + e.getDetailedMessage()); if (mp3file != null) deleteFile(mp3file.getFilename() + RETAG_EXTENSION); } catch (Exception e) {
public Mp3Rename(String filename, String rename) { try { String newFilename = composeNewFilename(filename, rename); String newFilenameWithPathAndExtension = FileUtils.extractPath(filename) + newFilename + FileUtils.extractExtension(filename); renameFile(filename, newFilenameWithPathAndExtension); printOut(FileUtils.extractFilename(newFilenameWithPathAndExtension)); } catch (BaseException e) { printError("ERROR processing \"" + FileUtils.extractFilename(filename) + "\" - " + e.getDetailedMessage()); } catch (Exception e) { printError("ERROR processing \"" + FileUtils.extractFilename(filename) + "\" - " + formatExceptionMessage(e)); } }