List of usage examples for org.apache.commons.io FileUtils copyDirectory
public static void copyDirectory(File srcDir, File destDir) throws IOException
From source file:ipat_fx.IPAT_FX.java
@Override public void start(Stage stage) throws Exception { String contextPath = System.getProperty("user.dir") + "/web/"; File logFile = new File(contextPath + "/log/log4j-IPAT.log"); System.setProperty("rootPath", logFile.getAbsolutePath()); Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml")); Scene scene = new Scene(root); stage.setScene(scene);//w w w.j ava 2 s . c o m stage.show(); stage.setOnHiding((WindowEvent event) -> { Platform.runLater(() -> { File src = new File(contextPath + "/Client Data"); DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss"); Date date = new Date(); File dest = new File(contextPath + "/Saves/Ipat_" + dateFormat.format(date)); if (!dest.exists()) { dest.mkdirs(); } try { FileUtils.copyDirectory(src, dest); } catch (IOException ex) { Logger.getLogger(IPAT_FX.class.getName()).log(Level.SEVERE, null, ex); } System.exit(0); }); }); }
From source file:com.thoughtworks.go.utils.TestRepoFixture.java
private File createRepository(File repoLocation) { if (testRepo == null) { testRepo = repoLocation;/*from w ww . j a va2 s. c o m*/ try { FileUtils.copyDirectory(templateRepo, testRepo); } catch (IOException e) { bomb(e); } } return testRepo; }
From source file:de.cosmocode.solr.SolrJServerTest.java
/** * Starts the Solr server before all tests run. * /*from w ww.jav a 2s.c o m*/ * @throws SAXException if an error occurs * @throws IOException if an error occurs * @throws ParserConfigurationException if an error occurs */ @BeforeClass public static void startServer() throws ParserConfigurationException, IOException, SAXException { LOG.debug("Starting Solr Server..."); final File solrDirectory = new File("src/test/resources/solr"); final File xml = new File(solrDirectory, "conf/solrconfig.xml"); final File data = new File(solrDirectory, "data"); tmpData = new File(solrDirectory, "tmpData"); FileUtils.copyDirectory(data, tmpData); tmpIndex = new File(tmpData, "index"); final CoreContainer container = new CoreContainer(); final SolrConfig config = new SolrConfig(solrDirectory.getAbsolutePath(), xml.getAbsolutePath(), null); final CoreDescriptor descriptor = new CoreDescriptor(container, "core1", tmpIndex.getAbsolutePath()); core = new SolrCore("core1", tmpData.getAbsolutePath(), config, null, descriptor); container.register("core1", core, false); server = new EmbeddedSolrServer(container, "core1"); LOG.debug("Started Solr Server"); }
From source file:com.google.cloud.tools.gradle.appengine.AppEngineStandardPluginIntegrationTest.java
@Before public void setUp() throws IOException { FileUtils.copyDirectory(new File("src/integTest/resources/projects/standard-project"), testProjectDir.getRoot());/*from w ww . ja v a2 s . co m*/ }
From source file:ch.ivyteam.ivy.maven.ProjectMojoRule.java
@Override @SuppressWarnings("unchecked") protected void before() throws Throwable { projectDir = Files.createTempDirectory("MyBaseProject").toFile(); FileUtils.copyDirectory(templateProjectDir, projectDir); project = readMavenProject(projectDir); mojo = (T) lookupConfiguredMojo(project, mojoName); }
From source file:azkaban.test.jobtype.JobTypeManagerTest.java
@Before public void setUp() throws Exception { File jobTypeDir = new File(TEST_PLUGIN_DIR); jobTypeDir.mkdirs();/*from w ww . ja va2 s.c om*/ FileUtils.copyDirectory(new File("unit/plugins/jobtypes"), jobTypeDir); manager = new JobTypeManager(TEST_PLUGIN_DIR, this.getClass().getClassLoader()); }
From source file:net.estinet.gFeatures.Feature.Gliders.ConfigHub.java
public void setupConfig() { List<Maps> maps = new ArrayList<>(); config.createDirectory("plugins/gFeatures/Gliders", "[Gliders] plugin directory set!"); File fl = new File("plugins/gFeatures/Gliders/MinigameSpawn"); File flz = new File("./MinigameSpawn"); flz.delete();//from w w w .ja v a 2s .com try { FileUtils.copyDirectory(fl, flz); } catch (IOException e) { e.printStackTrace(); } if (ctf1.isDirectory()) { maps.add(Maps.One); } if (ctf2.isDirectory()) { maps.add(Maps.Two); } if (maps.isEmpty()) { Bukkit.getLogger().info("[Gliders] No maps found!"); Disable.onDisable(); gFeatures.getFeature("Gliders").disable(); return; } ClioteSky.getInstance().sendAsync(ClioteSky.stringToBytes("Island"), "mgmap", "Bungee"); ci.createConfigs(); }
From source file:de.oppermann.pomutils.PomMergeDriverTest.java
@Override protected void setUp() throws Exception { super.setUp(); System.setProperty(org.slf4j.impl.SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "DEBUG"); File testTargetResourceFolder = new File("target/testresources/merge"); FileUtils.deleteDirectory(testTargetResourceFolder); FileUtils.copyDirectory(new File("src/test/resources/merge"), testTargetResourceFolder); }
From source file:its.tools.SonarlintProject.java
/** * Copies project to a temporary location and returns its root path. *///from w w w . ja v a2s .c o m public Path deployProject(String location) throws IOException { Path originalLoc = Paths.get("projects").resolve(location); String projectName = originalLoc.getFileName().toString(); if (!Files.isDirectory(originalLoc)) { throw new IllegalArgumentException( "Couldn't find project directory: " + originalLoc.toAbsolutePath().toString()); } cleanProject(); project = Files.createTempDirectory(projectName); FileUtils.copyDirectory(originalLoc.toFile(), project.toFile()); return project; }
From source file:com.aspectran.jetty.JettyServerTest.java
@BeforeAll void ready() throws Exception { String basePath = new File("target").getCanonicalPath(); File configFile = ResourceUtils.getResourceAsFile("config/aspectran-config.apon"); FileUtils.copyDirectory(ResourceUtils.getResourceAsFile("webapps"), new File(basePath, "webapps")); AspectranConfig aspectranConfig = new AspectranConfig(configFile); aspectranConfig.touchContextConfig().setBasePath(basePath); aspectran = EmbeddedAspectran.run(aspectranConfig); aspectran.translate("jetty start"); }