R.utils__copyDirectoryByPattern: copy Files and Directories Using a Regular Expression

Description Usage Arguments Examples

View source: R/econModelSupport.R

Description

1
2
3
Code copy of R.utils::copyDirectory.default with the addition of the
features pattern(source files) CaseChange(destination files).
The function is renamed to be R.utils__copyDirectoryByPattern

Usage

1
2
3
4
5
6
7
8
9
R.utils__copyDirectoryByPattern(
  from,
  to = ".",
  ...,
  private = T,
  recursive = T,
  pattern = NULL,
  CaseChange = NULL
)

Arguments

from

The pathname of the source directory to be copied.

to

The pathname of the destination directory.

...

Additional arguments passed to file.copy(), e.g. overwrite.

private

If TRUE, files (and directories) starting with a period is also copied, otherwise not.

recursive

If TRUE, subdirectories are copied too, otherwise not. Note, the name of the subdirectory also must in in "pattern".

pattern

regular expression of the names of the source files

CaseChange

string. Default is NULL(no change). Change to target file name to the desired case: NULL(no change), "UpperCase", "LowerCase".

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 

# R.utils__copyDirectoryByPattern example

R.utils__copyDirectoryByPattern("C:/Program Files (x86)/Stock Investor/Professional",
  to = tempdir(), pattern = "(*\\.dbf$|\\.*DBF$|\\.*DBF$|*.chm$|ReadMe\\.txt)",
  CaseChange = "UpperCase"
)
dir(tempdir())

## End(Not run)

AndreMikulec/econModel documentation built on June 30, 2021, 9:48 a.m.