Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unzip a .zip file

Tags:

r

I want to unzip a file in R. I completely don't know what to do.

I searched and I found it method like this :

unzip(zipfile, files = NULL, list = FALSE, overwrite = TRUE,       junkpaths = FALSE, exdir = ".", unzip = "internal",       setTimes = FALSE) 

but I don't know what should I do with this.

like image 965
saleh sereshki Avatar asked Oct 18 '15 22:10

saleh sereshki


People also ask

How do I unzip a zip file in Windows?

Open File Explorer and find the zipped folder. To unzip the entire folder, right-click to select Extract All, and then follow the instructions. To unzip a single file or folder, double-click the zipped folder to open it. Then, drag or copy the item from the zipped folder to a new location.

Why I Cannot extract a zip file?

Tip 1: Move the Zip File to Another Location A possible reason why you are encountering the Windows cannot complete the extraction error, is that the zip file is located in a protected place. You can fix this by moving the zip file to a different location like a different profile folder.

How to zip and unzip files in Windows?

How to Zip and Unzip Files 1 Open File Explorer and find the zipped folder. 2 To unzip the entire folder, right-click to select Extract All, and then follow the instructions. 3 To unzip a single file or folder, double-click the zipped folder to open it. See More....

How do I open a zipped file in Linux?

To unzip the entire folder, right-click to select Extract All, and then follow the instructions. To unzip a single file or folder, double-click the zipped folder to open it. Then, drag or copy the item from the zipped folder to a new location.

How do I open a zip file in Windows 10?

1 Open File Explorer and find the zipped folder. 2 To unzip the entire folder, right-click to select Extract All, and then follow the instructions. 3 To unzip a single file or folder, double-click the zipped folder to open it. Then, drag or copy the item from the zipped folder to a new location.

What is ZIP and how to use it?

Zip is a commonly used compression function which is portable and easy to use. You can even unzip files in Windows, that were created in Linux! Unzip is a utility that is not available on most Linux flavors by default, but can be easily installed. By creating .zip files you can match .tar.gz file compression! What Is Zip Used For?


1 Answers

You could do it like this:

zipF<-file.choose() # lets you choose a file and save its file path in R (at least for windows) outDir<-"C:\\Users\\Name\\Documents\\unzipfolder" # Define the folder where the zip file should be unzipped to  unzip(zipF,exdir=outDir)  # unzip your file  

Well you could also define both paths in R the classical way:

Assuming your zip file is named file.zip

zipF<- "C:\\path\\to\\my\\zipfile\\file.zip" outDir<-"C:\\Users\\Name\\Documents\\unzipfolder" unzip(zipF,exdir=outDir) 

exdir defines the directory to extract files to. It will be created if not already available. If you don't set exdir, unzip will just unzip it to your current working directory.

like image 137
Deset Avatar answered Oct 18 '22 04:10

Deset