Skip to content

Move Drive files to or from trash

Usage

drive_trash(file, verbose = deprecated())

drive_untrash(file, verbose = deprecated())

Arguments

file

Something that identifies the file(s) of interest on your Google Drive. Can be a character vector of names/paths, a character vector of file ids or URLs marked with as_id(), or a dribble.

verbose

[Deprecated] 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 helpers local_drive_quiet() or with_drive_quiet().

Value

An object of class dribble, a tibble with one row per file.

Examples

# Create a file and put it in the trash.
file <- drive_example_remote("chicken.txt") |>
  drive_cp("chicken-trash.txt")
#> Original file:
#>chicken.txt <id: 1wOLeWVRkTb6lDmLRiOhg9iKM7DlN762Y>
#> Copied to file:
#>chicken-trash.txt <id: 1loRezHtutObpRFMPMYNCCn4MzeLugshy>
drive_trash("chicken-trash.txt")
#> File trashed:
#>chicken-trash.txt <id: 1loRezHtutObpRFMPMYNCCn4MzeLugshy>

# Confirm it's in the trash
drive_find(trashed = TRUE)
#> # A dribble: 71 × 3
#>    name                 id       drive_resource   
#>    <chr>                <drv_id> <list>           
#>  1 chicken-trash.txt    1loRezH… <named list [44]>
#>  2 name-squatter-rename 1AKZ-gI… <named list [41]>
#>  3 name-squatter-mv     1XhjY-o… <named list [41]>
#>  4 name-squatter-upload 1jqPKMX… <named list [41]>
#>  5 name-squatter-rename 11P8Lgm… <named list [41]>
#>  6 name-squatter-mv     1nsc4Iw… <named list [41]>
#>  7 name-squatter-upload 1HIDfXi… <named list [41]>
#>  8 name-squatter-rename 1QhQA9Z… <named list [41]>
#>  9 name-squatter-mv     11yrtJ5… <named list [41]>
#> 10 name-squatter-upload 1QDyWHG… <named list [41]>
#> # ℹ 61 more rows

# Remove it from the trash and confirm
drive_untrash("chicken-trash.txt")
#> File untrashed:
#>chicken-trash.txt <id: 1loRezHtutObpRFMPMYNCCn4MzeLugshy>
drive_find(trashed = TRUE)
#> # A dribble: 70 × 3
#>    name                 id       drive_resource   
#>    <chr>                <drv_id> <list>           
#>  1 name-squatter-rename 1AKZ-gI… <named list [41]>
#>  2 name-squatter-mv     1XhjY-o… <named list [41]>
#>  3 name-squatter-upload 1jqPKMX… <named list [41]>
#>  4 name-squatter-rename 11P8Lgm… <named list [41]>
#>  5 name-squatter-mv     1nsc4Iw… <named list [41]>
#>  6 name-squatter-upload 1HIDfXi… <named list [41]>
#>  7 name-squatter-rename 1QhQA9Z… <named list [41]>
#>  8 name-squatter-mv     11yrtJ5… <named list [41]>
#>  9 name-squatter-upload 1QDyWHG… <named list [41]>
#> 10 name-squatter-rename 1TfHbhi… <named list [41]>
#> # ℹ 60 more rows

# Clean up
drive_rm("chicken-trash.txt")
#> File deleted:
#>chicken-trash.txt <id: 1loRezHtutObpRFMPMYNCCn4MzeLugshy>