Last active
March 28, 2021 20:02
-
-
Save vnegi10/07775aafc37c77ec7e3791d8e46aedac to your computer and use it in GitHub Desktop.
This file contains 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
# Cleanup csv files from previous days | |
try | |
main_dir = pwd() | |
cd("data") | |
files = readdir() | |
rx1 = r"data" | |
rx2 = r".csv" | |
for file in files | |
ts = Dates.unix2datetime(stat(file).mtime) | |
file_date = Date(ts) | |
if file_date != Dates.today() && occursin(rx1, file) && occursin(rx2, file) | |
rm(file) | |
end | |
end | |
cd(main_dir) | |
catch | |
println("Unable to perform cleanup action") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment