R Language Extracting and Listing Files in Compressed Archives Extract all .zip archives in a directory

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

With a simple for loop, all zip archives in a directory can be extracted.

for (i in dir(pattern=".zip$"))
    unzip(i)

The dir function produces a character vector of the names of the files in a directory matching the regex pattern specified by pattern. This vector is looped through with index i, using the unzip function to extract each zip archive.



Got any R Language Question?