-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcleanup_internal.R
More file actions
32 lines (23 loc) · 878 Bytes
/
cleanup_internal.R
File metadata and controls
32 lines (23 loc) · 878 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env Rscript
# Script to remove redirect files for internally hosted presentations
# This is a one-time cleanup script
library(yaml)
library(fs)
# Read the presentations data
presentations <- read_yaml("_presentations.yml")$presentations
# Get the internal presentation folders
internal_presentations <- presentations[sapply(presentations, function(p) {
if (!is.null(p$external) && p$external == FALSE) TRUE else FALSE
})]
internal_folders <- sapply(internal_presentations, function(p) p$folder)
cat("Checking for redirect HTML files in internal presentation folders...\n")
for (folder in internal_folders) {
html_path <- file.path(getwd(), folder, "index.html")
if (file_exists(html_path)) {
cat("Removing", html_path, "...\n")
file_delete(html_path)
} else {
cat("No HTML file found in", folder, "\n")
}
}
cat("\nCleanup complete!\n")