Example usage for org.apache.commons.io FileUtils copyFile

List of usage examples for org.apache.commons.io FileUtils copyFile

Introduction

In this page you can find the example usage for org.apache.commons.io FileUtils copyFile.

Prototype

public static void copyFile(File srcFile, File destFile) throws IOException 

Source Link

Document

Copies a file to a new location preserving the file date.

Usage

From source file:com.liferay.maven.plugins.util.FileUtil.java

public static void copyFile(File source, File destination) throws IOException {

    FileUtils.copyFile(source, destination);
}

From source file:TestUtils.java

public static void saveScreenshot(WebDriver driver, String screenshotFileName) throws IOException {
    File screenshot = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
    FileUtils.copyFile(screenshot, new File(screenshotFileName));
}

From source file:localSPs.CubbyAPI.java

public static void uploadFile(String fileName) throws IOException {
    java.io.File file = new java.io.File(UPLOAD_PATH + fileName);
    String newDir = ROOT_PATH;/*from   w  w w .  j a va 2s .co  m*/

    java.io.File newFile = new java.io.File(newDir + fileName);
    FileUtils.copyFile(file, newFile);

}

From source file:localSPs.BearDataShareAPI.java

public static void uploadFile(String fileName) throws IOException {
    java.io.File file = new java.io.File(UPLOAD_PATH + fileName);

    String newDir = ROOT_PATH;//from w  w w.j av  a  2  s . c o  m

    java.io.File newFile = new java.io.File(newDir + fileName);
    FileUtils.copyFile(file, newFile);
}

From source file:com.github.drbookings.io.Backup.java

public static void make(final File file) {
    if (file.exists() && file.length() != 0) {
        try {//from  w ww  .  j av a 2 s.co  m
            final File backupFile = new File(file.getParentFile(), file.getName() + ".bak");
            FileUtils.copyFile(file, backupFile);
            if (logger.isInfoEnabled()) {
                logger.info("Backup created as " + backupFile);
            }
        } catch (final IOException e) {
            if (logger.isErrorEnabled()) {
                logger.error(e.getLocalizedMessage(), e);
            }
        }
    }
}

From source file:de.uzk.hki.da.test.CTTestHelper.java

public static void prepareWhiteBoxTest() throws IOException {
    new CommandLineConnector().runCmdSynchronously(new String[] { "src/main/bash/collect.sh", "./" });

    new File("conf").mkdir();
    FileUtils.copyFile(new File(TC.CONFIG_PROPS_CI), new File(C.CONFIG_PROPS));
    FileUtils.copyFile(new File("src/main/resources/healthCheck.tif"), new File("conf/healthCheck.tif"));
    FileUtils.copyFile(new File(TC.FIDO_SH_SRC), new File(C.FIDO_GLUE_SCRIPT));
    FileUtils.copyDirectory(new File("../3rdParty/fido/fido"), C.FIDO_INSTALLATION.toFile());
    FileUtils.copyFile(new File("src/main/bash/configure.sh"), new File(C.CONFIGURE_SCRIPT));

    new File(C.FIDO_GLUE_SCRIPT).setExecutable(true);
    new File(C.CONFIGURE_SCRIPT).setExecutable(true);

    Runtime.getRuntime().exec("./" + C.CONFIGURE_SCRIPT);
    try {//ww  w  .  ja  va 2 s .  c o m
        Thread.sleep(2000);
    } catch (InterruptedException e) {
    }
}

From source file:com.googlecode.fannj.FannTest.java

public static File createTemp(File src) throws IOException {
    File temp = File.createTempFile("fannj_", ".net");
    temp.deleteOnExit();/*from  ww w  .j  a  va  2s  .  c  o m*/
    FileUtils.copyFile(src, temp);
    return temp;
}

From source file:edu.harvard.hul.ois.fits.junit.VideoStdSchemaTestXmlUnit_NoMD5.java

@BeforeClass
public static void setUpBeforeClass() throws Exception {

    System.out.println("Moving test fits.xml in");

    // Copy fits.xml to fits_back.xml
    FileUtils.copyFile(FileUtils.getFile("xml/fits.xml"), FileUtils.getFile("xml/fits_back.xml"));

    // Copy in test fits.xml
    FileUtils.copyFile(FileUtils.getFile("testfiles/properties/fits_no_md5_video.xml"),
            FileUtils.getFile("xml/fits.xml"));
}

From source file:edu.harvard.hul.ois.fits.junit.AudioStdSchemaTestXmlUnit_NoMD5.java

@BeforeClass
public static void setUpBeforeClass() throws Exception {

    System.out.println("Moving test fits.xml in");

    // Copy fits.xml to fits_back.xml
    FileUtils.copyFile(FileUtils.getFile("xml/fits.xml"), FileUtils.getFile("xml/fits_back.xml"));

    // Copy in test fits.xml
    FileUtils.copyFile(FileUtils.getFile("testfiles/properties/fits_no_md5_audio.xml"),
            FileUtils.getFile("xml/fits.xml"));
}

From source file:com.hp.test.framework.Reporting.screenshot.java

public static void generatescreenshot(String html_path, String Screenshot_file_path)
        throws MalformedURLException, FileNotFoundException, IOException {
    try {// w  w w.jav a  2s  .  com
        WebDriver driver = new FirefoxDriver();
        driver.manage().window().maximize();
        driver.get("file:///" + html_path);//+C:/Users/yanamalp/Desktop/DS_Latest/DSIntegrationTest/ATU%20Reports/Results/Run_3/CurrentRun.html");
        new Select(driver.findElement(By.id("tcFilter"))).selectByVisibleText("Skipped Test Cases");
        File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
        // Now you can do whatever you need to do with it, for example copy somewhere
        FileUtils.copyFile(scrFile, new File(Screenshot_file_path));
        driver.quit();
    } catch (Exception e) {
        log.error("Error in getting Screen shot for the Last run" + e.getMessage());
    }
}