| | |
| | | } |
| | | |
| | | /** |
| | | * Recursively copies any files or directories appearing in |
| | | * <code>source</code> or a subdirectory of <code>source</code> |
| | | * to the corresponding directory under <code>target</code>. Files |
| | | * in under <code>source</code> are not copied to <code>target</code> |
| | | * if a file by the same name already exists in <code>target</code>. |
| | | * |
| | | * @param source source directory |
| | | * @param target target directory |
| | | * @param filter for specifying particular files to synchronize |
| | | * @throws ApplicationException if there is a problem copying files |
| | | */ |
| | | public void synchronize(File source, File target, FileFilter filter) |
| | | throws ApplicationException |
| | | { |
| | | if (source != null && target != null) { |
| | | String[] sourceFileNames = source.list(); |
| | | if (sourceFileNames != null) { |
| | | for (String sourceFileName : sourceFileNames) { |
| | | File sourceFile = new File(source, sourceFileName); |
| | | copyRecursively(sourceFile, target, filter, false); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Renames the source file to the target file. If the target file exists |
| | | * it is first deleted. The rename and delete operation return values |
| | | * are checked for success and if unsuccessful, this method throws an |