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: 1h5lE6NBlbMm41rgDSLZAwaVSXWxfQuJm>
drive_trash("chicken-trash.txt")
#> File trashed:
#>  chicken-trash.txt <id: 1h5lE6NBlbMm41rgDSLZAwaVSXWxfQuJm>

# Confirm it's in the trash
drive_find(trashed = TRUE)
#> # A dribble: 102 × 3
#>    name                 id                                drive_resource
#>    <chr>                <drv_id>                          <list>        
#>  1 chicken-trash.txt    1h5lE6NBlbMm41rgDSLZAwaVSXWxfQuJm <named list>  
#>  2 name-squatter        1-_5PDgzasAnymjMKa8YjFGGdhq-Mya2Q <named list>  
#>  3 name-squatter        1dFvJgKgzUN-DmPW8py8_0fmfXuvN7Xi7 <named list>  
#>  4 name-squatter-upload 1M4oChRy-AtnKmWjbtxODfU0p00gxYPYs <named list>  
#>  5 name-squatter-rename 1lTdRtQkBAowb_hGwdWP5oq7nAxMgKfjR <named list>  
#>  6 name-squatter-mv     13FlFYR1XVHqXXuTqadeeZeKvV_eFJbsH <named list>  
#>  7 name-squatter-upload 1IvdfcQYjy9rG8oPegbuP2Q9JtrWPGgbw <named list>  
#>  8 name-squatter-rename 1CNKHlM84Xtqwu7yquED7vWW8qR19BhbK <named list>  
#>  9 name-squatter-mv     1uSg8aTc3ZLgtv_PC7D8kbusgcnpkoYNq <named list>  
#> 10 name-squatter-upload 1uEsx5dENLFGEkJvGm3qpvmjUCIJhG6gE <named list>  
#> # … with 92 more rows

# Remove it from the trash and confirm
drive_untrash("chicken-trash.txt")
#> File untrashed:
#>  chicken-trash.txt <id: 1h5lE6NBlbMm41rgDSLZAwaVSXWxfQuJm>
drive_find(trashed = TRUE)
#> # A dribble: 101 × 3
#>    name                 id                                drive_resource
#>    <chr>                <drv_id>                          <list>        
#>  1 name-squatter        1-_5PDgzasAnymjMKa8YjFGGdhq-Mya2Q <named list>  
#>  2 name-squatter        1dFvJgKgzUN-DmPW8py8_0fmfXuvN7Xi7 <named list>  
#>  3 name-squatter-upload 1M4oChRy-AtnKmWjbtxODfU0p00gxYPYs <named list>  
#>  4 name-squatter-rename 1lTdRtQkBAowb_hGwdWP5oq7nAxMgKfjR <named list>  
#>  5 name-squatter-mv     13FlFYR1XVHqXXuTqadeeZeKvV_eFJbsH <named list>  
#>  6 name-squatter-upload 1IvdfcQYjy9rG8oPegbuP2Q9JtrWPGgbw <named list>  
#>  7 name-squatter-rename 1CNKHlM84Xtqwu7yquED7vWW8qR19BhbK <named list>  
#>  8 name-squatter-mv     1uSg8aTc3ZLgtv_PC7D8kbusgcnpkoYNq <named list>  
#>  9 name-squatter-upload 1uEsx5dENLFGEkJvGm3qpvmjUCIJhG6gE <named list>  
#> 10 name-squatter-rename 1FlZtCAUMzkP6Yr61Rlu3qzT-xIN5MEkD <named list>  
#> # … with 91 more rows

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