Caution: this will permanently delete your files! For a safer, reversible
option, see drive_trash()
.
Usage
drive_rm(..., verbose = deprecated())
Arguments
- ...
One or more Drive files, specified in any valid way, i.e. as a
dribble
, by name or path, or by file id or URL marked withas_id()
. Or any combination thereof. Elements are processed withas_dribble()
and row-bound prior to deletion.- verbose
This logical argument to individual googledrive functions is deprecated. To globally suppress googledrive messaging, use
options(googledrive_quiet = TRUE)
(the default behaviour is to emit informational messages). To suppress messaging in a more limited way, use the helperslocal_drive_quiet()
orwith_drive_quiet()
.
Examples
# Target one of the official example files to copy (then remove)
(src_file <- drive_example_remote("chicken.txt"))
#> # A dribble: 1 × 3
#> name id drive_resource
#> <chr> <drv_id> <list>
#> 1 chicken.txt 1wOLeWVRkTb6lDmLRiOhg9iKM7DlN762Y <named list [36]>
# Create a copy, then remove it by name
src_file %>%
drive_cp(name = "chicken-rm.txt")
#> Original file:
#> • chicken.txt <id: 1wOLeWVRkTb6lDmLRiOhg9iKM7DlN762Y>
#> Copied to file:
#> • chicken-rm.txt <id: 1l4auMF8S-6iCPnTOGesSjtko41eFbOlL>
drive_rm("chicken-rm.txt")
#> File deleted:
#> • chicken-rm.txt <id: 1l4auMF8S-6iCPnTOGesSjtko41eFbOlL>
# Create several more copies
x1 <- src_file %>%
drive_cp(name = "chicken-abc.txt")
#> Original file:
#> • chicken.txt <id: 1wOLeWVRkTb6lDmLRiOhg9iKM7DlN762Y>
#> Copied to file:
#> • chicken-abc.txt <id: 1t0pKArq_04kVaFvTomygF19ZCE8JT64u>
drive_cp(src_file, name = "chicken-def.txt")
#> Original file:
#> • chicken.txt <id: 1wOLeWVRkTb6lDmLRiOhg9iKM7DlN762Y>
#> Copied to file:
#> • chicken-def.txt <id: 1MrnlIzvmBoRGX1IANHnASsEO_Bfpp5OY>
x2 <- src_file %>%
drive_cp(name = "chicken-ghi.txt")
#> Original file:
#> • chicken.txt <id: 1wOLeWVRkTb6lDmLRiOhg9iKM7DlN762Y>
#> Copied to file:
#> • chicken-ghi.txt <id: 1uCEGJth5qaS1uFjZ2ndOwOIFjKPs5HEr>
# Remove the copies all at once, specified in different ways
drive_rm(x1, "chicken-def.txt", as_id(x2))
#> Files deleted:
#> • chicken-abc.txt <id: 1t0pKArq_04kVaFvTomygF19ZCE8JT64u>
#> • chicken-def.txt <id: 1MrnlIzvmBoRGX1IANHnASsEO_Bfpp5OY>
#> • chicken-ghi.txt <id: 1uCEGJth5qaS1uFjZ2ndOwOIFjKPs5HEr>