Exemplo n.º 1
0
 public void mkdir(String newDirectoryName) {
   try {
     File newDirectory = new File(currentPath + "\\" + newDirectoryName);
     if (newDirectory.exists()) {
       System.out.println("Unable to create " + newDirectory.getAbsolutePath());
     } else {
       newDirectory.mkdir();
       System.out.println("Directory" + newDirectoryName + "created");
     }
   } finally {
     takePath();
   }
 }
Exemplo 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();
  }
Exemplo n.º 3
0
 // creaza si deschide fisierul cu numele specificat
 public void mkfile(String fileName) {
   try {
     File newFile = new File(currentPath + "\\" + fileName);
     if (newFile.exists()) {
       System.out.println("Unable to create " + newFile.getAbsolutePath());
     } else {
       newFile.createNewFile();
       System.out.println("Directory" + fileName + "created");
       openFile(fileName);
     }
   } catch (Exception e) {
     e.printStackTrace();
   } finally {
     takePath();
   }
 }
Exemplo n.º 4
0
 // creaza un nou disk si un nou sistem de fisiere pe acesta
 public void newDisk(String diskName) {
   try {
     File newDisk = new File(System.getProperty("user.dir").toString() + "/" + diskName);
     if (newDisk.exists()) {
       System.out.println("Unable to create " + newDisk.getAbsolutePath());
     } else {
       newDisk.mkdirs();
       System.out.println("New disk created:" + diskName);
       addDiskRefernce(diskName);
       currentDiskPath = System.getProperty("user.dir").toString() + "\\" + diskName;
       currentPath = currentDiskPath;
     }
   } finally {
     takePath();
   }
 }