List of usage examples for org.apache.commons.io FileUtils copyDirectory
public static void copyDirectory(File srcDir, File destDir) throws IOException
From source file:com.aliyun.openservices.odps.console.commands.HtmlModeCommand.java
public void run() throws OdpsException, ODPSConsoleException { getContext().setHtmlMode(true);//from w w w. j a va 2 s .c o m URL url = this.getClass().getClassLoader().getResource("html"); if (url == null) { throw new ODPSConsoleException("Html folder not exists in classpath."); } File source = new File(url.getFile()); File dest = new File("html"); if (dest.exists()) { System.err.println(dest + "exists."); return; } try { FileUtils.copyDirectory(source, dest); } catch (IOException e) { throw new ODPSConsoleException(e.getMessage(), e); } }
From source file:de.uzk.hki.da.cb.ShortenFileNamesActionTests.java
/** * Sets the up./* w w w . j a va 2 s. c om*/ * * @throws IOException Signals that an I/O exception has occurred. */ @Before public void setUp() throws IOException { n.setWorkAreaRootPath(new RelativePath(workAreaRootPath)); FileUtils.copyDirectory(new File(workAreaRootPath + "work/sources/identifier"), new File(workAreaRootPath + "work/TEST/identifier")); }
From source file:io.spring.gradle.testkit.junit.rules.TestKit.java
public GradleRunner withProjectDir(File projectDir) throws IOException { FileUtils.copyDirectory(projectDir, buildDir); return GradleRunner.create().withProjectDir(buildDir).withPluginClasspath(); }
From source file:com.github.ipaas.ideploy.agent.handler.BackupCodeHandler.java
@Override public void execute(String flowId, String cmd, Map<String, Object> params, BundleContext bundleContext) throws Exception { logger.debug("? flowId:" + flowId + " cmd:" + cmd + " params:" + params); String srcPath = String.valueOf(params.get("srcPath")); String targetPath = String.valueOf(params.get("targetPath")); File srcDir = new File(srcPath); // ?//from w ww . j av a 2 s. c o m if (!srcDir.exists()) { return; } File destDir = new File(targetPath); // if (destDir.exists() || destDir.getParentFile().exists()) { FileUtils.cleanDirectory(destDir.getParentFile()); } else { FileUtils.forceMkdir(destDir); } // FileUtils.copyDirectory(srcDir, destDir); logger.debug("??..."); }
From source file:com.kylinolap.job.hadoop.cube.CubeHFileMapper2Test.java
@Before public void setup() throws Exception { this.createTestMetadata(); // hack for distributed cache FileUtils.deleteDirectory(new File("../job/meta")); FileUtils.copyDirectory(new File(this.getTestConfig().getMetadataUrl()), new File("../job/meta")); CubeDesc desc = CubeManager.getInstance(this.getTestConfig()).getCube(cubeName).getDescriptor(); codec = new MeasureCodec(desc.getMeasures()); }
From source file:com.microsoft.Malmo.Utils.MapFileHelper.java
/** Attempt to copy the specified file into the Minecraft saves folder. * @param mapFile full path to the map file required * @param overwriteOldFiles if false, will rename copy to avoid overwriting any other saved games * @return if successful, a File object representing the new copy, which can be fed to Minecraft to load - otherwise null. *//*w w w. j a v a2s . c o m*/ static public File copyMapFiles(File mapFile, boolean isTemporary) { System.out.println("Current directory: " + System.getProperty("user.dir")); // Look for the basemap file. // If it exists, copy it into the Minecraft saves folder, // and attempt to load it. File savesDir = FMLClientHandler.instance().getSavesDir(); File dst = null; if (mapFile != null && mapFile.exists()) { dst = new File(savesDir, getNewSaveFileLocation(isTemporary)); try { FileUtils.copyDirectory(mapFile, dst); } catch (IOException e) { System.out.println("Failed to load file: " + mapFile.getPath()); return null; } } return dst; }
From source file:com.kylinolap.job.hadoop.cube.NewBaseCuboidMapperTest.java
@Before public void setUp() throws Exception { createTestMetadata();//from ww w .j a v a 2 s . c o m // hack for distributed cache FileUtils.deleteDirectory(new File("../job/meta")); FileUtils.copyDirectory(new File(this.getTestConfig().getMetadataUrl()), new File("../job/meta")); NewBaseCuboidMapper<Text> mapper = new NewBaseCuboidMapper<Text>(); mapDriver = MapDriver.newMapDriver(mapper); }
From source file:com.kylinolap.job.hadoop.cube.BaseCuboidMapperTest.java
@Before public void setUp() throws Exception { createTestMetadata();/*from w w w. ja v a 2s .c om*/ // hack for distributed cache FileUtils.deleteDirectory(new File("../job/meta")); FileUtils.copyDirectory(new File(this.getTestConfig().getMetadataUrl()), new File("../job/meta")); BaseCuboidMapper<Text> mapper = new BaseCuboidMapper<Text>(); mapDriver = MapDriver.newMapDriver(mapper); }
From source file:com.kylinolap.job.hadoop.cube.CubeReducerTest.java
@Before public void setUp() throws Exception { createTestMetadata();/*from w w w .j a v a 2 s . com*/ // hack for distributed cache FileUtils.deleteDirectory(new File("../job/meta")); FileUtils.copyDirectory(new File(this.getTestConfig().getMetadataUrl()), new File("../job/meta")); CuboidReducer reducer = new CuboidReducer(); reduceDriver = ReduceDriver.newReduceDriver(reducer); }
From source file:de.uzk.hki.da.cb.PostRetrievalActionTest.java
@Before public void setUp() throws IOException { n.setUserAreaRootPath(userAreaRootPath); o.setObject_state(Object.ObjectStatus.InWorkflow); j.setStatus("950"); FileUtils.copyDirectory(Path.makeFile(userAreaRootPath, TEST_USER_SHORT_NAME + UNDERSCORE), Path.makeFile(userAreaRootPath, TEST_USER_SHORT_NAME)); }