Package java.io

Examples of java.io.File.renameTo()


        if (renamed) {
            return true;
        }

        if (delete(newname)) {
            return file.renameTo(new File(newname));
        }

        return false;
    }
View Full Code Here


      if ( !jarFile.delete() )
        throw new Exception("cannot delete old "+oldJar.getCanonicalPath());
     
      File newJar = new File(tempfile);
     
      if ( !newJar.renameTo(oldJar) )
        throw new Exception("cannot rename tempfile "+tempfile+" to "+oldJar.getCanonicalPath());
     
    } catch (Exception e) {
      throw new Exception("cannot update jar: "+e.getMessage());
    }
View Full Code Here

      throw (new Exception(SOSClassUtil.getMethodName() + ": " + e.toString()));
    }
    finally {
      if (outFile != null)
        try {
          outFile.renameTo(inFile);
        }
        catch (Exception ex) {
        }
      if (in != null)
        try {
View Full Code Here

            }
            failedFile = new File(failedPath + this.getFailedPrefix() + failedName);
           
            messageFile = new File(workFile.getAbsolutePath() + "~");
            if (messageFile.exists()) messageFile.delete();
            workFile.renameTo(messageFile);
           
            // populate mailer with settings
            if (this.sosMailSettings != null) {
                sosMail = new SOSMail( this.sosMailSettings );
            } else {
View Full Code Here

            File fInNew = new File(fIn.getParent(), getNewUniqueName(fileName));
            fIn.renameTo(fInNew);
            // copy
            success = FileUtils.copyFileToDir(fInNew, fDropbox);
            // rename to old name
            fInNew.renameTo(fIn);
            fIn = fInNew;
          } else {
            success = FileUtils.copyFileToDir(fIn, fDropbox);
          }
        } else {
View Full Code Here

         out.write(dumpMessage(withAttachment));
      
         targetFile = new File(file.getAbsolutePath().replaceFirst("~$",""));
         tmpFile.delete();

         tmpFile.renameTo(targetFile);
                
      }catch (Exception e){
         throw new Exception(SOSClassUtil.getMethodName() + ": An error occurred on dumping: " + e.toString() );
       } finally {
         if ( out != null) try { out.close(); } catch(Exception e) {}
View Full Code Here

   */
  public void rename(String newName) {
    // rename meta info file name
    if (isDirectory()) { // rename the directory, which is the parent of the actual ".xml" file
      File metaFileDirectory = metaFile.getParentFile();
      metaFileDirectory.renameTo(new File(metaFileDirectory.getParentFile(), newName));
    } else { // rename the file
      metaFile.renameTo(new File(metaFile.getParentFile(), newName + ".xml"));
    }
  }
 
View Full Code Here

    String importedCalendarID = getImportedCalendarID(ureq, calendarName);
    String importedCalendarType = getImportedCalendarType();
   
    CalendarManager calManager = CalendarManagerFactory.getInstance().getCalendarManager();
    File oldCalendarFile = calManager.getCalendarFile(importedCalendarType, tempCalendarID);
    oldCalendarFile.renameTo(calManager.getCalendarFile(importedCalendarType, importedCalendarID));
   
    // make the entry in the database
    long timestamp = System.currentTimeMillis();
    PropertyManager pm = PropertyManager.getInstance();
    Property p = pm.createUserPropertyInstance(ureq.getIdentity(), PROP_CATEGORY, sanitize(calendarName), null, timestamp, importUrl, null);
View Full Code Here

      final File dst = new File(logdir, LOGBASE + i);
      final File src = new File(logdir, LOGBASE + (i - 1));
      if (dst.exists()) {
        dst.delete();
      }
      src.renameTo(dst);
    }
  }

  /**
   * Copies previous logs (assuming they have the same file name as
View Full Code Here

              path = new File(path, "#" + txtPort.getText()).getCanonicalPath();




            if(f.renameTo(new File(path))) { 
              if(type == SCHEDULER_HOST) {
                //port �ndern
                tree.getSelection()[0].getParentItem().setText(txtName.getText());
                tree.getSelection()[0].setText(txtPort.getText());                     
                tree.getSelection()[0].setData( path);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.