During the lifetime of your workspace, you might find the need to extract compressed files which have been added to the file system. Workspaces supports extracting files in .zip, .tar and .tgz format. In particular, items which are received via Workspace to Workspace Airlock will always arrive as a .zip file. There are numerous ways to extract these files.
Extract using the Extract button
An 'Extract' button is available in the sidebar for folders which have a .zip, .tar or .tgz extension. Simply select the file you wish to unzip and click the button. You will be presented with a pop-up box that includes information on where your files will be extracted.
You can either add some text to the box which will create a new folder with that name and extract the files there or you can leave the name blank and the extracted files will be added to the current folder of your zip file (e.g. Files). You also have the option to remove the zip file after the contents have been extracted.
Extract using a Virtual Desktop
If you have a Virtual Desktop available as part of your workspace, you may find it convenient to use the unzip functions there. Open your Virtual Desktop and find your file then use the built-in Windows or Linux functionality to extract your files.
Linux
Open the terminal and cd
into the directory where your .zip file is located. To extract your zipped file in the current folder, use the following command:
unzip file.zip
To extract the zipped file into a different directory, run:
sudo unzip file.zip -d /path/to/your/folder
When using a .tar or .tgx file, use:
tar -xvf <file>
For more help on the use of tar, use:
tar --help
Windows
Navigate to the folder where your .zip file is located. Right-click on it, select 'Extract All…' and then set the destination folder. Alternatively, you can do this using 7-Zip. Use 7-Zip to uncompress .tar or .tgz files.
Unzip via the R Console
You may choose to unzip your files using the R console. The following code snippet could be reused and adapted to work for your file. The following example assumes that the file you wish to unzip is called ‘unzipMe.zip’, is stored in the Files folder and that you wish to extract your files directly into the Files folder.
zipF <- "/home/workspace/files/unzipMe.zip"
outDir <-"/home/workspace/files"
unzip(zipF, exdir=outDir)