0
votes

I was wondering how I can exclude hidden files and folders in creating tar archive using R. The tar() method doesn't seem to have any parameter or flag to exclude hidden files and folders.

1
Use the files parameter - Dason

1 Answers

0
votes

This is the method I used to find out if a directory has hidden files and folders or not:

filesPresent <- function(object){
    if(length(list.files(path = object@ExpRootDir, recursive = FALSE, all.files = TRUE)) - 2 != length(list.dirs(path = object@ExpRootDir, recursive = FALSE))) # all.files = TRUE for Checking Hidden Files, -2 for Excluding . and .. 
      return(TRUE)
    else
      return(FALSE)
}