I have a R code running on our server  which downloads huge set of files from S3 and stores it in local and then loads those files into a data frame and once all the processing is done as a final step it deletes all the files from the local machine . Now if a error occurs ,the execution just halts which means someone has to manually intervene ,log into the server and run rm -rf on the data folder . Is there a way where I can have a try catch or a finally block (just like how we have in Java,Python ) where even incase of failure I can assure that the data folder is deleted from the local machine .
            Asked
            
        
        
            Active
            
        
            Viewed 54 times
        
    1
            
            
         
    
    
        arpit joshi
        
- 1,987
- 8
- 36
- 62
- 
                    2Have you looked at `help("tryCatch")`? – duckmayr Dec 20 '18 at 19:04
- 
                    2[This question](https://stackoverflow.com/questions/12193779/how-to-write-trycatch-in-r) might also help – mickey Dec 20 '18 at 19:04