IllegalArgumentException - if the source or destination is invalid. Throws: NullPointerException - if any of the given Files are null. preserveFileDate - true if the file date of the copy should be the same as the original. filter - the filter to apply, null means copy all directories and files. destDir - the new directory, must not be null. Parameters: srcDir - an existing directory to copy, must not be null. Since: 1.4Ĭopies a filtered directory to a new location.įpyDirectory(srcDir, destDir, DirectoryFileFilter.DIRECTORY, false) įpyDirectory(srcDir, destDir, filter, false) IOException - if an error occurs or setting the last-modified time didn't succeeded. FileNotFoundException - if the source does not exist. filter - the filter to apply, null means copy all directories and files should be the same as the original. Create a filter for either directories or ".txt" filesįileFilter filter = FileFilterUtils.orFileFilter(DirectoryFileFilter.DIRECTORY, txtFiles) įpyDirectory(srcDir, destDir, filter) IOFileFilter txtFiles = FileFilterUtils.andFileFilter(FileFileFilter.FILE, txtSuffixFilter) IOFileFilter txtSuffixFilter = FileFilterUtils.suffixFileFilter(".txt") Since: 1.1Ĭopies a filtered directory to a new location preserving the file dates.įpyDirectory(srcDir, destDir, DirectoryFileFilter.DIRECTORY)
If the modification operation fails, the methods throws IOException. Modified date/times using tLastModified(long), however it is not guaranteed that those operations Note: Setting preserveFileDate to true tries to preserve the files' last This method copies the contents of the specified source directory to within the specified destination directory.