Ejemplo n.º 1
0
 public void rename(String frompath, String topath)
     throws PhileNotFoundException, FileSystemException {
   File oldname = new File(currentPath + "\\" + frompath);
   boolean newname = oldname.renameTo(new File(currentPath + "\\" + topath));
   if (!newname) {
     throw new FileSystemException(currentPath + "\\" + topath);
   }
   takePath();
 }
Ejemplo n.º 2
0
  // copiaza frompath la topath
  public void move(String frompath, String topath) throws PhileNotFoundException {

    File from = new File(currentDiskPath + "\\" + frompath);

    String fullFromPath = from.getAbsolutePath();
    String fileName = fullFromPath.substring(fullFromPath.lastIndexOf("\\"), fullFromPath.length());

    File to = new File(currentDiskPath + "\\" + topath + fileName);

    if (from.exists() && to.getParentFile().isDirectory()) {
      from.renameTo(to);
    } else {
      System.out.println("Nu exista calea indicata");
    }
    takePath();
  }