Created
July 4, 2020 15:06
-
-
Save jatinsharrma/7089412eb1a2482d067ee53cd44db1d6 to your computer and use it in GitHub Desktop.
Extract Multiple ZIP / RAR files from one directory to another. Shell Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Script to extract Multiple RAR files and place each RAR file's content in its own directory | |
for z in *.rar | |
do | |
# removing all white space. Generating Directory name | |
c="$(echo -e "${z}" | tr -d '[:space:]')" | |
# Creating directory. Replace <Directory Address> with your own Directory Address. | |
mkdir /<Directory Address>/$c; | |
# Extracting rar file into its own new Directory. Replace <Directory Address> with your own Directory Address. | |
unrar x -r "$z" /<Directory Address>/$c; | |
done | |
#--------------------------------------------------------------------------- | |
#Script to extract Multiple Zip files and place each RAR file's content in its own directory | |
for z in *.zip | |
do | |
# removing all white space. Generating Directory name | |
c="$(echo -e "${z}" | tr -d '[:space:]')" | |
# Creating directory. Replace <Directory Address> with your own Directory Address. | |
mkdir /<Directory Address>/$c; | |
# Extracting rar file into its own new Directory. Replace <Directory Address> with your own Directory Address. | |
unzip "$z" -d /<Directory Address>/$c; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment