private void copy(File sourceFolder, File targetFolder, final FileFilter filter) { final File[] assets = sourceFolder.listFiles(filter); if (assets != null) { Arrays.sort(assets); for (File asset : assets) { final File target = new File(targetFolder, asset.getName()); if (asset.isFile()) { copyFile(asset, target); } else if (asset.isDirectory()) { copy(asset, target, filter); } } } }
/** * Copy one asset file at a time. * * @param asset The asset file to copy */ public void copySingleFile(File asset) { try { if ( !asset.isDirectory() ) { String targetPath = config.getDestinationFolder().getCanonicalPath() + File.separatorChar + assetSubPath(asset); LOGGER.info("Copying single asset file to [{}]", targetPath); copyFile(asset, new File(targetPath)); } else { LOGGER.info("Skip copying single asset file [{}]. Is a directory.", asset.getPath()); } } catch (IOException io) { LOGGER.error("Failed to copy the asset file.", io); } }
private void copy(File sourceFolder, File targetFolder, final FileFilter filter) { final File[] assets = sourceFolder.listFiles(filter); if (assets != null) { Arrays.sort(assets); for (File asset : assets) { final File target = new File(targetFolder, asset.getName()); if (asset.isFile()) { copyFile(asset, target); } else if (asset.isDirectory()) { copy(asset, target, filter); } } } }
/** * Copy one asset file at a time. * * @param asset The asset file to copy */ public void copySingleFile(File asset) { try { if ( !asset.isDirectory() ) { String targetPath = config.getDestinationFolder().getCanonicalPath() + File.separatorChar + assetSubPath(asset); LOGGER.info("Copying single asset file to [{}]", targetPath); copyFile(asset, new File(targetPath)); } else { LOGGER.info("Skip copying single asset file [{}]. Is a directory.", asset.getPath()); } } catch (IOException io) { LOGGER.error("Failed to copy the asset file.", io); } }