Description Usage Arguments Author(s) Examples
This will copy an entire directory using the faster copy options in Windows and Linux.
The function will default to file.copy
(which is slow). For lazyR databases,
this can be useful
for copying everything to a new computer, a network location etc.
1 2 3 |
fromDir |
The source lazyDir |
toDir |
The new lazyDir |
useRobocopy |
For Windows, this will use a system call to Robocopy which appears to be much
faster than the internal |
overwrite |
Passed to |
delDestination |
Logical, whether the destination should have any files deleted, if they don't exist in the source. This is /purge |
create |
Passed to |
silent |
Should a progress be printed |
Eliot McIntire
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ## Not run:
library(raster)
library(rgdal)
# make some objects
obj1 <- 1:10
obj2 <- 11:20
r <- raster::raster(matrix(1:9, ncol=3))
raster::writeRaster(r, file.path(tempdir(),"r.tif"), overwrite=TRUE)
raster::writeRaster(r, file.path(tempdir(),"ras.tif"), overwrite=TRUE)
rm(r, ras)
r <- raster::raster(file.path(tempdir(),"r.tif"))
ras <- raster::raster(file.path(tempdir(),"ras.tif"))
# identify a new and old lazyLoad db
fromDir <- file.path(tempdir(), "old")
toDir <- file.path(tempdir(), "new")
lazySave(obj1, r, ras, obj2, lazyDir=fromDir, overwrite=TRUE)
# copy to new lazyDir location
copyDir(fromDir, toDir, create=TRUE)
# remove the objects in memory and the old lazyLoad db
rm(obj1, obj2, r, ras)
unlink(fromDir, recursive=TRUE)
lazyLoad2(lazyDir=toDir) # Objects should be visible after this
ls()
unlink(toDir, recursive=TRUE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.