if (FALSE) {
# create dummy directories for tests
# (normally, you'd use directory containing renamed, unsorted images)
# this will be used as inDir
wd_createDirTest <- file.path(getwd(), "createSpeciesFoldersTest")
# now we create 2 station subdirectories
dirs_to_create <- file.path(wd_createDirTest, c("StationA", "StationB"))
sapply(dirs_to_create, FUN = dir.create, recursive = TRUE)
# species names for which we want to create subdirectories
species <- c("Sambar Deer", "Bay Cat")
# create species subdirectories
SpecFolderCreate1 <- createSpeciesFolders (inDir = wd_createDirTest,
species = species,
hasCameraFolders = FALSE,
removeFolders = FALSE)
SpecFolderCreate1
# check if directories were created
list.dirs(wd_createDirTest)
# delete empty species directories
SpecFolderCreate2 <- createSpeciesFolders (inDir = wd_createDirTest,
species = species,
hasCameraFolders = FALSE,
removeFolders = TRUE)
SpecFolderCreate2
# check if species directories were deleted
list.dirs(wd_createDirTest)
}
Run the code above in your browser using DataLab