Java Code Examples for org.apache.commons.io.FileUtils#moveDirectory()
The following examples show how to use
org.apache.commons.io.FileUtils#moveDirectory() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SharedFolderWithWritePermissionMoveOutTest.java From Hive2Hive with MIT License | 6 votes |
@Test public void testSynchronizeAddSubFolderFromBMoveOutFromA() throws NoSessionException, NoPeerConnectionException, IOException, IllegalArgumentException, IllegalArgumentException, GetFailedException { logger.info("Upload a new file 'sharedFolder/subfolder1FromB' from B."); File subFolder1FromBAtB = new File(sharedFolderB, "subfolder1FromB"); subFolder1FromBAtB.mkdir(); UseCaseTestUtil.uploadNewFile(network.get(1), subFolder1FromBAtB); logger.info("Wait till new file 'sharedFolder/subfolder1FromB' gets synchronized with A."); File subfolder1FromAAtA = new File(sharedFolderA, subFolder1FromBAtB.getName()); waitTillSynchronized(subfolder1FromAAtA, true); logger.info("Move file 'sharedFolder/subfolder1FromB' from A to root folder of A."); File movedFolder1FromAAtA = new File(rootA, subfolder1FromAAtA.getName()); FileUtils.moveDirectory(subfolder1FromAAtA, movedFolder1FromAAtA); UseCaseTestUtil.moveFile(network.get(0), subfolder1FromAAtA, movedFolder1FromAAtA); logger.info("Wait till moving of file 'shardFolder/subfolder1FromB' gets synchronized with B."); waitTillSynchronized(subFolder1FromBAtB, false); checkIndexes(subfolder1FromAAtA, subFolder1FromBAtB, movedFolder1FromAAtA, true); }
Example 2
Source File: EventsExample.java From Hive2Hive with MIT License | 6 votes |
@Override @Handler public void onFileMove(IFileMoveEvent fileEvent) { try { // Move the file to the new destination if it exists if (fileEvent.isFile() && fileEvent.getSrcFile().exists()) { FileUtils.moveFile(fileEvent.getSrcFile(), fileEvent.getDstFile()); System.out.println("File was moved from " + fileEvent.getSrcFile() + " to " + fileEvent.getDstFile()); } else if (fileEvent.isFolder() && fileEvent.getSrcFile().exists()) { FileUtils.moveDirectory(fileEvent.getSrcFile(), fileEvent.getDstFile()); System.out.println("Folder was moved from " + fileEvent.getSrcFile() + " to " + fileEvent.getDstFile()); } } catch (IOException e) { e.printStackTrace(); } }
Example 3
Source File: PitMojoIT.java From pitest with Apache License 2.0 | 6 votes |
@Test public void shouldCorrectlyHandleOverrides() throws Exception { File testDir = prepareSiteTest("/pit-site-custom-config"); File targetDir = buildFilePath(testDir, "target"); File expectedSiteReportDir = buildFilePath(testDir, "target", "site", "foobar"); FileUtils.moveDirectory(buildFilePath(targetDir, "pit-reports"), buildFilePath(targetDir, "new-report-location")); verifier.executeGoal("site"); String projectReportsHtmlContents = FileUtils .readFileToString(buildFilePath(testDir, "target", "site", "project-reports.html")); assertTrue( "did not find expected anchor tag to pit site report", projectReportsHtmlContents .contains("<a href=\"foobar/index.html\" title=\"my-test-pit-report-name\">my-test-pit-report-name</a>")); assertTrue("expected site report directory [" + expectedSiteReportDir + "] does not exist but should exist", expectedSiteReportDir.exists()); assertFalse( "expected default site report directory exists but should not exist since the report location parameter was overridden", buildFilePath(testDir, "target", "site", "pit-reports").exists()); }
Example 4
Source File: SharedFolderWithWritePermissionMoveInTest.java From Hive2Hive with MIT License | 6 votes |
@Test public void testSynchronizeMoveFolderFromAIntoSharedSubFolderAtA() throws NoSessionException, NoPeerConnectionException, IOException, IllegalArgumentException, IllegalArgumentException, GetFailedException { logger.info("Upload a new folder 'subfolderFromA' into root folder of A."); File folderFromAAtA = new File(rootA, "subfolderFromA"); folderFromAAtA.mkdir(); UseCaseTestUtil.uploadNewFile(network.get(0), folderFromAAtA); logger.info("Move folder 'subfolderFromA' at A into shared folder 'sharedfolder/subfolder'."); File movedFolderFromAAtA = new File(subFolderA, folderFromAAtA.getName()); FileUtils.moveDirectory(folderFromAAtA, movedFolderFromAAtA); UseCaseTestUtil.moveFile(network.get(0), folderFromAAtA, movedFolderFromAAtA); logger.info("Wait till new moved in folder 'subfolderFromA' gets synchronized with B."); File movedFolderFromAAtB = new File(subFolderB, folderFromAAtA.getName()); waitTillSynchronized(movedFolderFromAAtB, true); compareFiles(movedFolderFromAAtA, movedFolderFromAAtB); checkIndex(movedFolderFromAAtA, movedFolderFromAAtB); }
Example 5
Source File: SharedFolderWithWritePermissionMoveInTest.java From Hive2Hive with MIT License | 6 votes |
@Test public void testSynchronizeMoveFolderFromAIntoSharedFolderAtA() throws NoSessionException, NoPeerConnectionException, IOException, IllegalArgumentException, IllegalArgumentException, GetFailedException { logger.info("Upload a new folder 'folderFromA' into root folder of A."); File folderFromAAtA = new File(rootA, "folderFromA"); folderFromAAtA.mkdir(); UseCaseTestUtil.uploadNewFile(network.get(0), folderFromAAtA); logger.info("Move folder 'folderFromA' at A into shared folder 'sharedfolder'."); File movedFolderFromAAtA = new File(sharedFolderA, folderFromAAtA.getName()); FileUtils.moveDirectory(folderFromAAtA, movedFolderFromAAtA); UseCaseTestUtil.moveFile(network.get(0), folderFromAAtA, movedFolderFromAAtA); logger.info("Wait till new moved in folder 'folderFromA' gets synchronized with B."); File movedFolderFromAAtB = new File(sharedFolderB, folderFromAAtA.getName()); waitTillSynchronized(movedFolderFromAAtB, true); compareFiles(movedFolderFromAAtA, movedFolderFromAAtB); checkIndex(movedFolderFromAAtA, movedFolderFromAAtB); }
Example 6
Source File: SharedFolderWithReadPermissionMoveInTest.java From Hive2Hive with MIT License | 6 votes |
@Test public void testSynchronizeMoveAtAFolderAtAIntoSharedFolder() throws NoSessionException, NoPeerConnectionException, IOException, IllegalArgumentException, IllegalArgumentException, GetFailedException { File folderFromAAtA = new File(rootA, "folderFromA"); folderFromAAtA.mkdir(); logger.info("Upload a new folder '{}' into root folder of A.", folderFromAAtA.getName()); UseCaseTestUtil.uploadNewFile(nodeA, folderFromAAtA); logger.info("Move folder '{}' at A into shared folder '{}'.", folderFromAAtA.getName(), sharedFolderA.getName()); File movedFolderFromAAtA = new File(sharedFolderA, folderFromAAtA.getName()); FileUtils.moveDirectory(folderFromAAtA, movedFolderFromAAtA); UseCaseTestUtil.moveFile(network.get(0), folderFromAAtA, movedFolderFromAAtA); logger.info("Wait till new moved in folder '{}' gets synchronized with B.", movedFolderFromAAtA.toString()); File movedFolderFromAAtB = new File(sharedFolderB, folderFromAAtA.getName()); waitTillSynchronized(movedFolderFromAAtB, true); compareFiles(movedFolderFromAAtA, movedFolderFromAAtB); checkIndex(movedFolderFromAAtA, movedFolderFromAAtB); }
Example 7
Source File: SharedFolderWithReadPermissionMoveOutTest.java From Hive2Hive with MIT License | 6 votes |
@Test public void testSynchronizeAddSubfolderAtAMoveOutAtA() throws NoSessionException, NoPeerConnectionException, IOException, IllegalArgumentException, IllegalArgumentException, GetFailedException { File folderFromAAtA = new File(subFolderA, "subfolder1FromA"); folderFromAAtA.mkdir(); logger.info("Upload a new folder '{}' at A.", folderFromAAtA.toString()); UseCaseTestUtil.uploadNewFile(nodeA, folderFromAAtA); logger.info("Wait till new folder '{}' gets synchronized with B.", folderFromAAtA.toString()); File folderFromAAtB = new File(subFolderB, folderFromAAtA.getName()); waitTillSynchronized(folderFromAAtB, true); logger.info("Move folder '{}' at A to root folder of A.", folderFromAAtA.toString()); File movedFolderFromAAtA = new File(rootA, folderFromAAtA.getName()); FileUtils.moveDirectory(folderFromAAtA, movedFolderFromAAtA); UseCaseTestUtil.moveFile(nodeA, folderFromAAtA, movedFolderFromAAtA); logger.info("Wait till moving of folder '{}' to '{}' gets synchronized with B.", folderFromAAtA.toString(), movedFolderFromAAtA.toString()); waitTillSynchronized(folderFromAAtB, false); checkIndexesAfterMoving(folderFromAAtA, folderFromAAtB, movedFolderFromAAtA); }
Example 8
Source File: SharedFolderWithReadPermissionMoveOutTest.java From Hive2Hive with MIT License | 6 votes |
@Test public void testSynchronizeAddFolderAtAMoveOutAtA() throws NoSessionException, NoPeerConnectionException, IOException, IllegalArgumentException, IllegalArgumentException, GetFailedException { File folderFromAAtA = new File(sharedFolderA, "folder1FromA"); folderFromAAtA.mkdir(); logger.info("Upload a new folder '{}' at A.", folderFromAAtA.toString()); UseCaseTestUtil.uploadNewFile(nodeA, folderFromAAtA); logger.info("Wait till new folder '{}' gets synchronized with B.", folderFromAAtA.toString()); File folderFromAAtB = new File(sharedFolderB, folderFromAAtA.getName()); waitTillSynchronized(folderFromAAtB, true); logger.info("Move folder '{}' at A to root folder of A.", folderFromAAtA.toString()); File movedFolderFromAAtA = new File(rootA, folderFromAAtA.getName()); FileUtils.moveDirectory(folderFromAAtA, movedFolderFromAAtA); UseCaseTestUtil.moveFile(nodeA, folderFromAAtA, movedFolderFromAAtA); logger.info("Wait till moving of folder '{}' to '{}' gets synchronized with B.", folderFromAAtA.toString(), movedFolderFromAAtA.toString()); waitTillSynchronized(folderFromAAtB, false); checkIndexesAfterMoving(folderFromAAtA, folderFromAAtB, movedFolderFromAAtA); }
Example 9
Source File: SharedFolderWithWritePermissionMoveInTest.java From Hive2Hive with MIT License | 6 votes |
@Test public void testSynchronizeMoveFolderFromBIntoSharedSubFolderAtB() throws NoSessionException, NoPeerConnectionException, IOException, IllegalArgumentException, IllegalArgumentException, GetFailedException { logger.info("Upload a new folder 'subfolderFromB' into root folder of B."); File folderFromBAtB = new File(rootB, "subfolderFromB"); folderFromBAtB.mkdir(); UseCaseTestUtil.uploadNewFile(network.get(1), folderFromBAtB); logger.info("Move folder 'subfolderFromB' at B into shared folder 'sharedFolder/subfolder'."); File movedFolderFromBAtB = new File(subFolderB, folderFromBAtB.getName()); FileUtils.moveDirectory(folderFromBAtB, movedFolderFromBAtB); UseCaseTestUtil.moveFile(network.get(1), folderFromBAtB, movedFolderFromBAtB); logger.info("Wait till new moved in folder 'subfolderFromB' gets synchronized with A."); File movedFolderFromBAtA = new File(subFolderA, folderFromBAtB.getName()); waitTillSynchronized(movedFolderFromBAtA, true); compareFiles(movedFolderFromBAtA, movedFolderFromBAtB); checkIndex(movedFolderFromBAtA, movedFolderFromBAtB); }
Example 10
Source File: SharedFolderWithReadPermissionMoveInternalTest.java From Hive2Hive with MIT License | 6 votes |
@Test public void testSynchronizeAddSubfolderAtAMoveToFolderAtA() throws NoSessionException, NoPeerConnectionException, IOException, IllegalArgumentException, IllegalArgumentException, GetFailedException { File folderFromAAtA = new File(subFolder1A, "subfolder1FromA"); folderFromAAtA.mkdir(); logger.info("Upload a new folder '{}' at A.", folderFromAAtA.getName()); UseCaseTestUtil.uploadNewFile(nodeA, folderFromAAtA); logger.info("Wait till new folder '{}' gets synchronized with B.", folderFromAAtA.getName()); File folderFromAAtB = new File(subFolder1B, folderFromAAtA.getName()); waitTillSynchronized(folderFromAAtB, true); File movedFolderFromAAtA = new File(sharedFolderA, folderFromAAtA.getName()); logger.info("Move folder '{}' at A into shared subfolder '{}'.", folderFromAAtA.getName(), sharedFolderA); FileUtils.moveDirectory(folderFromAAtA, movedFolderFromAAtA); UseCaseTestUtil.moveFile(nodeA, folderFromAAtA, movedFolderFromAAtA); logger.info("Wait till new moved folder '{}' gets synchronized with B.", folderFromAAtA.getName()); File movedFolderFromAAtB = new File(sharedFolderB, folderFromAAtA.getName()); waitTillSynchronized(movedFolderFromAAtB, true); compareFiles(movedFolderFromAAtA, movedFolderFromAAtB); checkIndexAfterMoving(folderFromAAtA, folderFromAAtB, movedFolderFromAAtA, movedFolderFromAAtB); }
Example 11
Source File: GFileUtils.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public static void moveDirectory(File source, File destination) { try { FileUtils.moveDirectory(source, destination); } catch (IOException e) { throw new UncheckedIOException(e); } }
Example 12
Source File: GitProctorTest.java From proctor with Apache License 2.0 | 5 votes |
private String renameTestDefinition( final String srcTestName, final String dstTestName, final String message ) throws IOException, GitAPIException, StoreException { resetStageAndWorkingTreeToHEAD(); final File srcDir = getPathToDefinitionDirectory().resolve(srcTestName).toFile(); final File dstDir = getPathToDefinitionDirectory().resolve(dstTestName).toFile(); FileUtils.moveDirectory(srcDir, dstDir); final String revision = commitAllWorkingTreeChanges(message); gitProctor.refresh(); return revision; }
Example 13
Source File: GFileUtils.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public static void moveDirectory(File source, File destination) { try { FileUtils.moveDirectory(source, destination); } catch (IOException e) { throw new UncheckedIOException(e); } }
Example 14
Source File: PersistentContentMapperStore.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
/** * Called when a repository has been renamed. This renames the repository folder in the cache, so that the cache * does not suddenly only produces misses for the renamed repository. * * @param formerName * the previous name of the repository * @param newName * the new name of the repository */ private void repositoryRenamed(String formerName, String newName) { try { Path oldRepoDir = storeRepoRootPath.resolve(formerName); Path newRepoDir = storeRepoRootPath.resolve(newName); if (Files.exists(oldRepoDir)) { FileUtils.moveDirectory(oldRepoDir.toFile(), newRepoDir.toFile()); } } catch (IOException e) { LogService.getRoot().log(Level.WARNING, "com.rapidminer.repository.PersistentContentMapperStore.repo_rename_update_failed", e); } }
Example 15
Source File: MultiLindenCoreImpl.java From linden with Apache License 2.0 | 5 votes |
public synchronized LindenCore getLindenCore(String indexName) throws IOException { LindenCore lindenCore = lindenCoreMap.get(indexName); if (lindenCore == null) { lindenCore = new LindenCoreImpl(config, indexName); lindenCoreMap.put(indexName, lindenCore); if (config.getMultiIndexMaxLiveIndexNum() != -1 && config.getMultiIndexMaxLiveIndexNum() < lindenCoreMap.size()) { List<String> keys = new ArrayList<>(lindenCoreMap.keySet()); Collections.sort(keys, new Comparator<String>() { @Override public int compare(String o1, String o2) { return o1.compareTo(o2); } }); String oldestIndexName = keys.get(0); LindenCore core = lindenCoreMap.remove(oldestIndexName); core.close(); if (config.getIndexType() != LindenConfig.IndexType.RAM) { String dir = FilenameUtils.concat(baseIndexDir, oldestIndexName); String destDir = FilenameUtils.concat(baseIndexDir, EXPIRED_INDEX_NAME_PREFIX + oldestIndexName); if (new File(dir).exists()) { FileUtils.moveDirectory(new File(dir), new File(destDir)); } } } } return lindenCore; }
Example 16
Source File: MultiLindenCoreImpl.java From linden with Apache License 2.0 | 5 votes |
private Response deleteIndex(LindenIndexRequest request) throws IOException { // Only INDEX_NAME division type supports index delete if (multiIndexStrategy instanceof TimeLimitMultiIndexStrategy || multiIndexStrategy instanceof DocNumLimitMultiIndexStrategy) { return ResponseUtils.buildFailedResponse("Index delete is not supported in current multi-index core"); } if (request.getIndexName() == null) { return ResponseUtils.buildFailedResponse("Index name is not set in index delete request."); } String fullIndexName = MultiIndexStrategy.MULTI_INDEX_PREFIX_NAME + request.getIndexName(); if (lindenCoreMap.containsKey(fullIndexName)) { LindenCore core = lindenCoreMap.remove(fullIndexName); if (core != null) { core.close(); } if (config.getIndexType() != LindenConfig.IndexType.RAM) { String dir = FilenameUtils.concat(baseIndexDir, fullIndexName); String destDir = FilenameUtils.concat(baseIndexDir, "delete_" + fullIndexName); if (new File(dir).exists()) { FileUtils.moveDirectory(new File(dir), new File(destDir)); } } return ResponseUtils.SUCCESS; } return ResponseUtils.buildFailedResponse("Index " + request.getIndexName() + " is not found."); }
Example 17
Source File: SegmentIndexCreationDriverImpl.java From incubator-pinot with Apache License 2.0 | 4 votes |
private void handlePostCreation() throws Exception { ColumnStatistics timeColumnStatistics = segmentStats.getColumnProfileFor(config.getTimeColumnName()); int sequenceId = config.getSequenceId(); if (timeColumnStatistics != null) { segmentName = config.getSegmentNameGenerator() .generateSegmentName(sequenceId, timeColumnStatistics.getMinValue(), timeColumnStatistics.getMaxValue()); } else { segmentName = config.getSegmentNameGenerator().generateSegmentName(sequenceId, null, null); } try { // Write the index files to disk indexCreator.setSegmentName(segmentName); indexCreator.seal(); } finally { indexCreator.close(); } LOGGER.info("Finished segment seal!"); // Delete the directory named after the segment name, if it exists final File outputDir = new File(config.getOutDir()); final File segmentOutputDir = new File(outputDir, segmentName); if (segmentOutputDir.exists()) { FileUtils.deleteDirectory(segmentOutputDir); } // Move the temporary directory into its final location FileUtils.moveDirectory(tempIndexDir, segmentOutputDir); // Delete the temporary directory FileUtils.deleteQuietly(tempIndexDir); // Convert segment format if necessary convertFormatIfNecessary(segmentOutputDir); // Build star-tree V2 if necessary buildStarTreeV2IfNecessary(segmentOutputDir); // Compute CRC and creation time long crc = CrcUtils.forAllFilesInFolder(segmentOutputDir).computeCrc(); long creationTime; String creationTimeInConfig = config.getCreationTime(); if (creationTimeInConfig != null) { try { creationTime = Long.parseLong(creationTimeInConfig); } catch (Exception e) { LOGGER.error("Caught exception while parsing creation time in config, use current time as creation time"); creationTime = System.currentTimeMillis(); } } else { creationTime = System.currentTimeMillis(); } // Persist creation metadata to disk persistCreationMeta(segmentOutputDir, crc, creationTime); LOGGER.info("Driver, record read time : {}", totalRecordReadTime); LOGGER.info("Driver, stats collector time : {}", totalStatsCollectorTime); LOGGER.info("Driver, indexing time : {}", totalIndexTime); }
Example 18
Source File: AppResource.java From app-runner with MIT License | 4 votes |
@POST @Consumes({"application/octet-stream", "application/zip"}) @Path("/{name}/data") @Description(value = "Sets the contents of the app's data directory with the contents of the zip file") @ApiResponse(code = "204", message = "Files uploaded successfully") public Response setAppData(@Required @Description(value = "The name of the app", example = "app-runner-home") @PathParam("name") String name, @Description("A zip file containing files that will be unzipped") @Required InputStream requestBody) throws IOException { AppDescription ad = getAppDescription(name); if (ad.dataDir().listFiles().length > 0) { return Response.status(400).entity("File uploading is only supported for apps with empty data directories.").build(); } log.info("Setting data for " + name); String dataDirPath = ad.dataDir().getCanonicalPath(); File unzipTo = fileSandbox.tempDir("post-data-" + UUID.randomUUID().toString()); String unzipToPath = unzipTo.getCanonicalPath(); log.info("Going to unzip files to temp dir " + unzipToPath); int filesUnzipped = 0; try (ZipInputStream zis = new ZipInputStream(requestBody)) { ZipEntry nextEntry; while ((nextEntry = zis.getNextEntry()) != null) { filesUnzipped++; String destPath = FilenameUtils.concat(unzipToPath, nextEntry.getName()); File dest = new File(destPath); if (nextEntry.isDirectory()) { if (dest.mkdirs()) { log.info("Created " + destPath); } else { log.warn("Failed to create " + destPath); } } else { if (dest.getParentFile().mkdirs()) { log.info("Created " + dest.getParentFile()); } log.info("Unzipping " + (nextEntry.getName())); try (FileOutputStream fos = new FileOutputStream(dest, false)) { IOUtils.copy(zis, fos); } } } } if (filesUnzipped > 0) { log.info("Going to move temp dir to app data path " + ad.dataDir().getCanonicalPath()); if (!ad.dataDir().delete()) { log.warn("Could not delete old data dir"); } FileUtils.moveDirectory(unzipTo, new File(dataDirPath)); } return Response.status(204).build(); }
Example 19
Source File: Sample650TestCase.java From product-ei with Apache License 2.0 | 3 votes |
@BeforeClass(alwaysRun = true) public void uploadSynapseConfig() throws Exception { super.init(); serverManager = new ServerConfigurationManager(context); File existingDir = new File(FrameworkPathUtil.getCarbonHome() + File.separator + "samples" + File.separator + "service-bus" + File.separator + "synapse_sample_650.xml"); File newDir = new File( FrameworkPathUtil.getCarbonHome() + File.separator + "samples" + File.separator + "service-bus" + File.separator + "default" ); File targetDir = new File(FrameworkPathUtil.getCarbonHome() + File.separator + "samples" + File.separator + "service-bus" + File.separator + "synapse_sample_650.xml" + File.separator + "default"); FileUtils.moveDirectory(existingDir, newDir); FileUtils.moveDirectory(newDir, targetDir); serverManager.applyConfiguration(new File(TestConfigurationProvider.getResourceLocation() + File.separator + "artifacts" + File.separator + "ESB" + File.separator + "miscellaneous" + File.separator + "axis2.xml")); // serverManager.restartGracefully(); super.init(); endPointAdminClient = new EndPointAdminClient(contextUrls.getBackEndUrl(), getSessionCookie()); localEntriesAdminClient = new LocalEntriesAdminClient(contextUrls.getBackEndUrl(), getSessionCookie()); sequenceAdminServiceClient = new SequenceAdminServiceClient(contextUrls.getBackEndUrl(), getSessionCookie()); taskAdminClient = new TaskAdminClient(contextUrls.getBackEndUrl(), getSessionCookie()); }
Example 20
Source File: BasicConfig.java From Lipi with MIT License | 2 votes |
@FXML private void onNextButton() { String confBlogNameText = confBlogTitleField.getText(); String confBlogThemeText = confThemeChoice.getValue().getName(); String confAuthorNameText = confBlogAuthorField.getText(); DirectoryChooser blogDirChooser = new DirectoryChooser(); blogDirChooser.setTitle("Select a folder to create your blog, Or maybe make a new one?"); File selectedDirectory = blogDirChooser.showDialog(this.getScene().getWindow()); if (selectedDirectory != null) { try { String selectedDirPath = selectedDirectory.getCanonicalPath(); //history is saved WelcomeWizard.storeBlogHistory(selectedDirPath); //New site is created in program path!! FIX LATER String newSite = TabbedHMDPostEditor.toPrettyURL(confBlogNameText); new Hugo(selectedDirPath).hugoMakeSite(newSite); Path tempLoc = FileSystems.getDefault().getPath(newSite); System.out.println(tempLoc.toAbsolutePath()); String newBlogsPath = selectedDirPath + File.separator + newSite; FileUtils.moveDirectory(new File(newSite), new File(newBlogsPath)); //WRITE CONFIG TomlConfig tomlConfig = new TomlConfig(hugoDefaultConfigFilePath); Map<String, Object> mainTomlConfigMap = tomlConfig.getTomlMap(); mainTomlConfigMap.put("title", confBlogNameText); mainTomlConfigMap.put("theme", confBlogThemeText); Map<String, Object> paramsMap = (Map<String, Object>) tomlConfig.getTomlMap().get("params"); paramsMap.put("Author", confAuthorNameText); mainTomlConfigMap.put("params", paramsMap); tomlConfig.setTomlMap(mainTomlConfigMap); TomlConfig newToml = new TomlConfig(newBlogsPath + File.separator + "config.toml"); newToml.setTomlMap(tomlConfig.getTomlMap()); newToml.writeTomlMap(); FileUtils.copyDirectory(new File(hugoBlogThemesDirPath), new File(newBlogsPath + File.separator + "themes")); FileUtils.copyDirectory(new File(hugoBlogExampleBlogDirPath), new File(newBlogsPath)); WelcomeWizard.openDirBlog(new File(newBlogsPath), primaryStage); } catch (IOException e) { ExceptionAlerter.showException(e); e.getMessage(); } } }