-
-
Save Cynesiz/57c96644a471c54727237bc02930f75c to your computer and use it in GitHub Desktop.
Unzip Zipped Rar Files in Bash
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 unpack sceen releases | |
#Source: http://ubuntuforums.org/archive/index.php/t-1716443.html | |
#unzip all zip files | |
for i in `find . -name "*.zip"`; do unzip -o -d `dirname $i` $i;done; | |
#delete all zip files | |
for i in `find . -name "*.zip"`; do rm $i;done; | |
#unrar recusively | |
find ./* -type f -name '*.rar' -execdir unrar x {} \; | |
#remove rar | |
for i in `find . -name "*.r??"`; do rm $i;done; | |
#remove sample folder | |
for i in `find . -name "Sample"`; do rm -r $i;done; | |
#print list of all folders | |
ls -d */ > dirlist.txt | |
#keep just the site name | |
sed 's/_.*//g' dirlist.txt > dirlist2.txt | |
#remove duplicate entries | |
cat dirlist2.txt|uniq > dirlist3.txt | |
#make directories | |
for d in $(cat dirlist3.txt); do mkdir $d; done | |
#move directors | |
for d in $(cat dirlist3.txt); do mv $d?* $d; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment