Description Usage Arguments Value Examples
Extracts files matching a pattern from a directory, copying and/or removing duplicate files (based on a user-supplied function) if specified. If a destination directory is specified, files will be copied (and not overwritten, even if filenames are identical).
1 2 |
source_dir |
the directory to look for the files |
pattern |
the pattern of files (NULL for all files) to extract |
destination_dir |
the directory to which files will be copied (NULL if files should not be copied) |
remove_duplicates |
TRUE if duplicate files (based on the function supplied in unique_fun) should be removed from the list (they will not be deleted). If destination_dir is specified, the duplicate files will not be copied. If a file to be copied already exists in destination_dir (as determined by unique_fun), the file will not be copied but the name of the existing file will be included in the list of files returned. |
unique_fun |
the function that will return a unique value for unique files. the most reliable is probably tools::md5sum() (the default), but for large files this is slow and file.size() may be adequate. In some cases basename() may also be sufficient. |
verbose |
TRUE if status messages should be printed. |
A list of file paths. If destination_dir is specified, the list of file paths will be to the copied files. If not, the list of file paths will be relative to the working directory.
1 | extract_files(getwd(), "*.*", remove_duplicates=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.