Description Usage Arguments Value Examples
This function is a wrapper around fs::file_delete()
, with the a
console-based confirmation and, if ask = TRUE
, the user
will be prompted to confirm the deletion.
1 | file_delete(path, ask = FALSE)
|
path |
A character vector of the file path(s) to be deleted. |
ask |
Logical: FALSE by default. Should the user be prompted whether or not the file(s) should be deleted? |
The deleted file path(s) (invisibly).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | if (interactive()) {
# Create multiple files -- not opening them
jdtools::file_new_text("test-file_delete", open = FALSE)
jdtools::file_new_r("test-file_delete", open = FALSE)
jdtools::file_new_md("test-file_delete", open = FALSE)
jdtools::file_new_js("test-file_delete", open = FALSE)
# Just delete the text file
file_delete(path = "test-file_delete.txt",
ask = FALSE)
# Ask about whether to delete the R file
file_delete(path = "test-file_delete.R",
ask = TRUE)
# Ask about whether to delete the markdown and JavaScript files
file_delete(path = c("test-file_delete.md", "test-file_delete.js"),
ask = TRUE)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.