unzipping .nc files from many BZIP folders in R

72 views Asked by At

I’m trying to extract .nc files from PowerArchiver BZIP in R from many different folders, would anyone be able to help me do this?

I have a code to extract and select the files but when I try and unzip using codes provided in previous stack overflow support (e.g. unzip a .zip file) I can’t find a code that works:

 < Warning message: In unzip(zipF, exdir = outDir) :
 error 1 in extracting from zip file> 

Below is the R code I have to extract the files once out of the Zip files:

File <- dir("I:/Turbidity", include.dirs = FALSE, all.files = FALSE, recursive = TRUE)  # to select all files and not the file paths 

str(File) #21328 files 

FUllList <- NULL 
for(r_a_traiter in File){    
FileList <- NULL   
if(as.character(substr(r_a_traiter, 18,45))== as.character("-EUR-L4-SPIM-ATL-v01-fv01-OI"))  ###character path = ‘1998/001/19980101-EUR-L4-SPIM-ATL-v01-fv01-OI.nc’ 
{ list_fichier_short <-r_a_traiter }   
FUllList <- c(FUllList, FileList)  
} 

str(FUllList)#7301`
0

There are 0 answers