Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# count the number of files and folders
years <- c('2010', '2011', '2012', '2013', '2014', '2015', '2016', '2017', '2018')
directory <- '/Users/erikgregorywebb/Documents/Python/runtwolf/R/'
for (i in 1:length(years)) {
file_count = 0
setwd(paste(directory, years[i], '/XC', sep = ""))
folders <- list.files()
for (j in 1:length(folders)) {
setwd(paste(directory, years[i], '/XC/', folders[j], sep = ""))
files <- list.files()
file_count = file_count + length(files)
}
print(paste(years[i], file_count, length(folders), sep = " "))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.