Last active
April 6, 2016 02:32
-
-
Save innerlee/df0a4a2afb2298a0a6f82675aa4c16f5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# This script untars all the .tar file to their own folers | |
# | |
# for all tar files | |
# if not tarred, i.e., no dir with same name | |
# tar it to its temp folder | |
# rename this temp folder to filename | |
for tar in map(x->x[1:end-4], filter(x->isfile(x) && length(x) > 4 && x[end-3:end] == ".tar", readdir())) | |
if(!isdir(tar)) | |
isdir("$tar.temp") && rm("$tar.temp") | |
mkdir("$tar.temp") | |
run(`tar -xf $tar.tar -C $tar.temp`) | |
mv("$tar.temp", tar) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment