Automatically Delete Files/Folders

前端 未结 5 590
自闭症患者
自闭症患者 2020-11-27 04:09

Is there any way to automatically delete all files or folders with few R command lines? I am aware of the unlink() or file.remove() functions, but

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-27 05:04

    Maybe you're just looking for a combination of file.remove and list.files? Maybe something like:

    do.call(file.remove, list(list.files("C:/Temp", full.names = TRUE)))
    

    And I guess you can filter the list of files down to those whose names match a certain pattern using grep or grepl, no?

提交回复
热议问题