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

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

Introduction

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

Prototype

public static void copyDirectory(File srcDir, File destDir) throws IOException 

Source Link

Document

Copies a whole directory to a new location preserving the file dates.

Usage

From source file:Artemis_Expanded_Skyboxes.System20.java

public static void system20() {

    // Path copyfrom = FileSystems.getDefault().getPath(dirRoot + systemNo + "/" + dirName + "/");
    //Path target = FileSystems.getDefault().getPath("D:/Artemis/art/sb12/");
    //Path target_dir = FileSystems.getDefault().getPath("D:/Artemis/art/sb12");
    for (int x = 12; x <= 29; x++) {
        dirNo = Integer.toString(x);

        File source = new File(sourceDir + dirName + dirNo + "/");
        File dest = new File(targetDir + dirName + dirNo + "/");
        try {// ww w.j a v  a  2  s  .com
            FileUtils.copyDirectory(source, dest);
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

}

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

public static void cleanandCreate(String Reports_path, int last_run) {

    String temp_path = Reports_path + "\\temp";

    deleteDir(new File(temp_path));
    File file = new File(temp_path);
    boolean isDirectoryCreated = file.mkdir();
    if (isDirectoryCreated) {
        log.info("successfully Created directory");
    } else {//from w w  w .  jav  a  2 s .  c  o  m
        file.delete();
        file.mkdir();
        log.info("deleted and Created directory");
    }

    File trgDir = new File(temp_path);

    File srcDir = new File(Reports_path);

    try {
        FileUtils.copyDirectory(srcDir, trgDir);
        log.info("Copying reports to temp path is completed");
    } catch (IOException ex) {
        log.error("Issue with the copying reports to temp directory" + ex.getMessage());
    }
    try {
        removerunlinks.removelinksforpreRuns(temp_path + "\\results\\", "ConsolidatedPage.html", last_run);
    } catch (IOException ex) {
        log.error("Error in removing links from the page ConsolidatedPage.html" + ex.getMessage());
    }
    for (int i = 1; i < last_run; i++) {
        try {
            deleteDir(new File(temp_path + "\\results\\Run_" + i));
        } catch (Exception ex) {
            log.error("Not able to delete directory" + temp_path + "\\results\\Run_" + i);
        }
        log.error("Deleted" + temp_path + "\\results\\Run_" + i);
    }
    FileUtils.deleteQuietly(new File(temp_path + "\\ISTF_Reports.zip"));
    // ZipUtils.ZipFolder(temp_path, Reports_path+);

}

From source file:de.akquinet.innovation.play.maven.Helper.java

public static void copyJavaApp(File out) throws IOException {
    if (out.exists()) {
        FileUtils.deleteQuietly(out);//  w  w  w. j a  v a2s .  c  o m
    }
    out.mkdirs();

    FileUtils.copyDirectory(JAVA_APP_ROOT, out);
}

From source file:css.variable.converter.CSSVariableConverter.java

public static void start(File sourceDirectory, File releaseDirectory) {

    try {/*from ww w  .ja v a2 s.  co m*/
        FileUtils.copyDirectory(sourceDirectory, releaseDirectory);
        loadCSSFiles(releaseDirectory);// Find those CSS files
        File mainFile = getMainCSSFile();// Ask which file is the main file(so we can get variables)
        ArrayList<CSSVar> rootCSSVars = getCSSVars(mainFile, ":root");// Collect variables from main file
        editForRelease(rootCSSVars);// Go through existing CSS Files and replace variable access with variable values
    } catch (IOException ex) {
        Logger.getLogger(CSSVariableConverter.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:de.oppermann.pomutils.TestUtils.java

public static void prepareTestFolder(String subFolder) throws IOException {
    String targetFolder = resourceBaseTestFolder + "/" + subFolder;
    File targetFolderFile = new File(targetFolder);
    FileUtils.deleteDirectory(targetFolderFile);
    FileUtils.copyDirectory(new File("src/test/resources/" + subFolder), targetFolderFile);
}

From source file:net.estinet.gFeatures.Feature.Gliders.Enable.java

public static void onEnable() {
    Bukkit.getLogger().info("[Gliders] Enabled :D");
    ch.setupConfig();//from w  w w .  j  a  v a2  s .  c om

    File f = new File("plugins/gFeatures/Gliders/Gliders2");
    File fz = new File("./Gliders2");

    fz.delete();
    try {
        FileUtils.copyDirectory(f, fz);
    } catch (IOException e) {
        e.printStackTrace();
    }
    f = new File("plugins/gFeatures/Gliders/Gliders1");
    fz = new File("./Gliders1");
    fz.delete();
    try {
        FileUtils.copyDirectory(f, fz);
    } catch (IOException e) {
        e.printStackTrace();
    }

    Capture c = new Capture();
    c.loop();
    Bukkit.getScheduler().scheduleSyncDelayedTask(Bukkit.getServer().getPluginManager().getPlugin("gFeatures"),
            () -> {
                WorldCreator cs = new WorldCreator("MinigameSpawn");
                Bukkit.getServer().createWorld(cs);

                WorldCreator cs1 = new WorldCreator("Gliders1");
                Bukkit.getServer().createWorld(cs1);

                WorldCreator cs2 = new WorldCreator("Gliders2");
                Bukkit.getServer().createWorld(cs2);

                ClioteSky.getInstance().send(new byte[0], "mghello", "Bungee");
            }, 40L);
    Bukkit.getScheduler()
            .scheduleSyncRepeatingTask(Bukkit.getServer().getPluginManager().getPlugin("gFeatures"), () -> {
                ConstantCheck cc = new ConstantCheck();
                cc.goThrough();
            }, 20L, 20L);
}

From source file:com.theminequest.MineQuest.Quest.QuestWorldManip.java

public static World copyWorld(World w) throws IOException {
    String newname;//from w  ww.  java  2 s.co m
    File newdirectory;
    do {
        newname = "mqinstance_" + randGen.nextLong();
        newdirectory = new File(newname);
    } while (newdirectory.exists());
    FileUtils.copyDirectory(w.getWorldFolder(), newdirectory);

    File uid = new File(newdirectory + File.separator + "uid.dat");
    if (uid.exists())
        uid.delete();

    WorldCreator tmp = new WorldCreator(newname);
    tmp.copy(w);
    return Bukkit.createWorld(tmp);
}

From source file:de.akquinet.innovation.play.maven.Helper.java

public static void copyMavenApp(File out) throws IOException {
    if (out.exists()) {
        FileUtils.deleteQuietly(out);/*from  ww w  . j a v a 2s .c o m*/
    }
    out.mkdirs();

    FileUtils.copyDirectory(MAVEN_APP_ROOT, out);
}

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 {//w  ww.  ja  va  2  s  .  c  o  m
        Thread.sleep(2000);
    } catch (InterruptedException e) {
    }
}

From source file:net.estinet.gFeatures.Feature.FusionPlay.GameUtil.WorldUtil.java

public static void copyWorld(File f) {
    Bukkit.getLogger().info("[FusionPlay] Loading world " + f.getName() + "...");
    File fz = new File("./world");
    fz.delete();//from w  w  w .  ja  v  a  2 s  . com
    try {
        FileUtils.copyDirectory(f, fz);
        Bukkit.getLogger().info("[FusionPlay] World loading completed.");
    } catch (IOException e) {
        e.printStackTrace();
    }
}