-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompressScripts.py
More file actions
29 lines (21 loc) · 1.14 KB
/
compressScripts.py
File metadata and controls
29 lines (21 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/python
import os
import subprocess
getPath = os.path.expanduser('~/Documents/Scripts/')
scriptsPath = subprocess.check_output("ls -l " + getPath + " | grep -v ^d | awk '{print$9}'", shell=True)
scripts = scriptsPath.split()
otherScriptsPath = subprocess.check_output("ls -la " + getPath + "others/" + " | grep -v ^d | awk '{print$9}'", shell=True)
otherScripts = otherScriptsPath.split()
fetchPlistsPath = subprocess.check_output("ls -la " + getPath + "fetchPlists/" + " | grep -v ^d | awk '{print$9}'", shell=True)
fetchPlists = fetchPlistsPath.split()
os.system("mkdir " + getPath + "compressed")
for name in scripts:
file_contents = os.system("tar -C " + getPath + " -zvcf " + getPath + "compressed/" + name + ".zip " + name)
print (file_contents)
for name in otherScripts:
file_contents = os.system("tar -C " + getPath + "others/ -zvcf " + getPath + "compressed/" + name + ".zip " + name)
print (file_contents)
for name in fetchPlists:
file_contents = os.system("tar -C " + getPath + "fetchPlists/ -zvcf " + getPath + "compressed/" + name + ".zip " + name)
print (file_contents)
os.system("chmod +x " + getPath + "compressed/*.zip")