Let my HOME alone 1/2
This commit is contained in:
parent
2ae37e902e
commit
a83e45df5e
94 changed files with 328 additions and 58 deletions
34
config/scripts/unziptree
Executable file
34
config/scripts/unziptree
Executable file
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
for root, dirs, files in os.walk("."):
|
||||
for name in files:
|
||||
base, ext = os.path.splitext(name)
|
||||
if name.endswith(".zip"):
|
||||
cmd = ["unzip"]
|
||||
elif name.endswith(".7z"):
|
||||
cmd = ["7z", "e"]
|
||||
elif name.endswith(".rar"):
|
||||
cmd = ["unrar", "x"]
|
||||
elif name.endswith('.tar'):
|
||||
cmd = ["tar", "xf"]
|
||||
elif name.endswith('.tar.gz'):
|
||||
cmd = ["tar", "xzf"]
|
||||
elif name.endswith('.tar.xz'):
|
||||
cmd = ["tar", "xJf"]
|
||||
else:
|
||||
continue
|
||||
|
||||
filepath = os.path.join(root, name)
|
||||
dirpath = os.path.join(root, base)
|
||||
print(filepath)
|
||||
|
||||
os.mkdir(dirpath)
|
||||
|
||||
cmd.append(os.path.realpath(filepath))
|
||||
r = subprocess.run(cmd, cwd=dirpath)
|
||||
r.check_returncode()
|
||||
|
||||
os.unlink(filepath)
|
Loading…
Add table
Add a link
Reference in a new issue