當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


R googledrive drive_rm 從雲端硬盤刪除文件


注意:這將永久刪除您的文件!如需更安全、可逆的選項,請參閱drive_trash()

用法

drive_rm(..., verbose = deprecated())

參數

...

以任何有效方式指定的一個或多個雲端硬盤文件,即通過名稱或路徑、或者通過標有 as_id() 的文件 ID 或 URL 指定為 dribble 。或其任意組合。元素在刪除之前使用as_dribble() 和row-bound 進行處理。

verbose

[Deprecated]這種對各個 googledrive 函數的邏輯論證已被棄用。要全局禁止 googledrive 消息傳遞,請使用options(googledrive_quiet = TRUE)(默認行為是發出信息性消息)。要以更有限的方式抑製消息傳遞,請使用幫助程序local_drive_quiet()或者with_drive_quiet().

邏輯向量,表示刪除是否成功。

也可以看看

例子

# 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 [38]>

# 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: 1F2_NR-3oYprCrinOX7ktGGhrGDVL691L>
drive_rm("chicken-rm.txt")
#> File deleted:
#> • chicken-rm.txt <id: 1F2_NR-3oYprCrinOX7ktGGhrGDVL691L>

# 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: 1WsAeToXFGijEStXd03F4Pyb6TEeF3e0u>
drive_cp(src_file, name = "chicken-def.txt")
#> Original file:
#> • chicken.txt <id: 1wOLeWVRkTb6lDmLRiOhg9iKM7DlN762Y>
#> Copied to file:
#> • chicken-def.txt <id: 1YWeFvk8pOZG2QKqgAEWuiJDJ_mpao7nu>
x2 <- src_file %>%
  drive_cp(name = "chicken-ghi.txt")
#> Original file:
#> • chicken.txt <id: 1wOLeWVRkTb6lDmLRiOhg9iKM7DlN762Y>
#> Copied to file:
#> • chicken-ghi.txt <id: 1zyBhXeOSYDiXaPsLyzFx2io7dbT0xvnD>

# 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: 1WsAeToXFGijEStXd03F4Pyb6TEeF3e0u>
#> • chicken-def.txt <id: 1YWeFvk8pOZG2QKqgAEWuiJDJ_mpao7nu>
#> • chicken-ghi.txt <id: 1zyBhXeOSYDiXaPsLyzFx2io7dbT0xvnD>
源代碼:R/drive_rm.R

相關用法


注:本文由純淨天空篩選整理自Jennifer Bryan等大神的英文原創作品 Delete files from Drive。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。