

When reading the help for 7z in your cmd window, you will notice that the -o switch is the output directory option. Batch script to unzip files into a certain folder You can also reinstate the code to delete the compressed form of the file if that seems appropriate to you. (*) echo "$0: unrecognized extension $extn on $file" >&2 (7z) un7z "./$base.$extn" # Or whatever the command is (rar) unrar "./$base.$extn" # Or whatever the command is However, if rar and 7z do behave like zip, then you can use: case $extn in The corresponding compressors (or decompressors), simply decompress the file (losing the compression suffix) without extracting the data from the. Typically, you have a composite format such as. However, you should be aware that not all compressors also package multiple files. Now, in theory, you could extend the list of extensions in the case statement to include other file formats. This code might work: for file in "$file") zip files, you'd probably revise the code to use the file names it is given as arguments as the files to uncompress. Given a requirement to handle formats other than just. You'll need to modify the code to handle sub-directories containing. The code assumes that the current directory is the 'parent folder' which contains all the zipped files. If it is named filename.bat, you should be able to use sudo bash filename.bat to run it. Yes, that code fragment looks like a bash script.
#UNZIP A ZIPX FILE HOW TO#
Unzip \*.zip How to unzip different compression formats in subfolders in Linux terminal This works in bash, according to this link: Or, run it together on one line: for file in *.zip do dir=$(basename "$file". "$file" # unzip and remove file if successful You could do something like this: for file in *.zip doĭir=$(basename "$file". Unix unzip: how to batch unzip zip files in a folder and save in subfolders?
