file.copy2 {fda} | R Documentation |
Copy a file appending a number to make the to
name unique, with
default to
= from
.
file.copy2(from, to)
from |
character: name of a file to be copied |
to |
character: name of copy. Default = from with an integer
appended to the name.
|
1. length(from) != 1: Error: Only one file can be copied.
2. file.exists(from)? If no, If no, return FALSE.
3. if(missing(to))to <- from; else if(length(to)!=1) error.
4. file.exists(to)? If yes, Dir <- dir(dirname(to)), find all
Dir
starting with to
, and find the smallest integer to
append to make a unique to
name.
5. file.copy(from, to)
6. Return TRUE.
logical: TRUE (with a name = name of the file created); FALSE if no file created.
Spencer Graves
## Not run: file.copy2('startup.m') # Used by 'fdaMatlabPath' so an existing 'startup.m' is not destroyed ## End(Not run)