Skip to content

Instantly share code, notes, and snippets.

@innerlee
Last active April 6, 2016 02:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save innerlee/df0a4a2afb2298a0a6f82675aa4c16f5 to your computer and use it in GitHub Desktop.
Save innerlee/df0a4a2afb2298a0a6f82675aa4c16f5 to your computer and use it in GitHub Desktop.
# 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