Created
December 12, 2020 19:39
-
-
Save EmilHvitfeldt/eb7896d3df476cb7962cda4c0eeffdb2 to your computer and use it in GitHub Desktop.
Render files in subdirectories for markdown websites
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new_render <- function(dir = "readings") { | |
old_names <- fs::dir_ls(dir) | |
new_names <- basename(old_names) | |
if (any(new_names %in% fs::dir_ls())) { | |
stop("Files in folders can not have same name as main files") | |
} | |
fs::file_move(old_names, new_names) | |
rmarkdown::render_site() | |
fs::file_move(new_names, old_names) | |
} | |
new_render() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment