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

# Confirm it's in the trash
drive_find(trashed = TRUE)
#> # A dribble: 93 × 3
#>    name                 id                                drive_resource
#>    <chr>                <drv_id>                          <list>        
#>  1 chicken-trash.txt    1R83O27ymspvHp5R8iNDGR5x0jmcj7eSr <named list>  
#>  2 name-squatter-rename 1Ms5VnuZ0Zj6YwYH_--QRPn23S9mAK1-H <named list>  
#>  3 name-squatter-mv     1g5GU11l_To47XfVsCrG5myp__NF3NS1F <named list>  
#>  4 name-squatter-upload 1wtq4eiawMmjuKyxiqCxN6gWTU_iV0qhn <named list>  
#>  5 name-squatter-rename 1PIiHD7U_LUlvp8wJP7gqHnpoYYow-jc6 <named list>  
#>  6 name-squatter-mv     1hi9pfUDZfFIIlhQb4HKXwtJ8bM9H17pw <named list>  
#>  7 name-squatter-upload 1UVAF7m4aUlMyLw6MdFnqNKMimpF4TiHm <named list>  
#>  8 name-squatter-rename 1azGH1OEyLQPqlK_3x_AoXmlup4FOAqtL <named list>  
#>  9 name-squatter-mv     1ybTgSBYCCLEIewR16hm7lqt-uDJPknUD <named list>  
#> 10 name-squatter-upload 1CtvelVN6eMCkP30DXa8QRlyjs4p0a8lZ <named list>  
#> # ℹ 83 more rows

# Remove it from the trash and confirm
drive_untrash("chicken-trash.txt")
#> File untrashed:
#>chicken-trash.txt <id: 1R83O27ymspvHp5R8iNDGR5x0jmcj7eSr>
drive_find(trashed = TRUE)
#> # A dribble: 92 × 3
#>    name                 id                                drive_resource
#>    <chr>                <drv_id>                          <list>        
#>  1 name-squatter-rename 1Ms5VnuZ0Zj6YwYH_--QRPn23S9mAK1-H <named list>  
#>  2 name-squatter-mv     1g5GU11l_To47XfVsCrG5myp__NF3NS1F <named list>  
#>  3 name-squatter-upload 1wtq4eiawMmjuKyxiqCxN6gWTU_iV0qhn <named list>  
#>  4 name-squatter-rename 1PIiHD7U_LUlvp8wJP7gqHnpoYYow-jc6 <named list>  
#>  5 name-squatter-mv     1hi9pfUDZfFIIlhQb4HKXwtJ8bM9H17pw <named list>  
#>  6 name-squatter-upload 1UVAF7m4aUlMyLw6MdFnqNKMimpF4TiHm <named list>  
#>  7 name-squatter-rename 1azGH1OEyLQPqlK_3x_AoXmlup4FOAqtL <named list>  
#>  8 name-squatter-mv     1ybTgSBYCCLEIewR16hm7lqt-uDJPknUD <named list>  
#>  9 name-squatter-upload 1CtvelVN6eMCkP30DXa8QRlyjs4p0a8lZ <named list>  
#> 10 name-squatter-rename 18sSfXc8w4I_34_jjzSUPxBWcALXWNTcR <named list>  
#> # ℹ 82 more rows

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