-
Notifications
You must be signed in to change notification settings - Fork 0
/
preparedeploymentpackage.py
executable file
·46 lines (35 loc) · 1.15 KB
/
preparedeploymentpackage.py
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# import packages
import zipfile
import os
from zipfile import ZipFile
# delete zip from drive
def deletezip():
os.remove("twtd.zip")
print("Zip File Deleted")
#deletezip()
# zip up file into a zip archive, ready for Lambda Upload
def zipfile(file):
zipf = ZipFile("twtd.zip","a")
zipf.write(file)
zipf.close()
print(file + " zipped")
# calls for individuals files - these need to be listed as files
#zipfile("InteractionControl.py")
def listfiles():
# get current file list
filelist = os.listdir("/Users/stevengooday/Desktop/Alexa/TWTD")
# for each file in the list
for file in filelist:
# test if the file is directory, if it is loop that directory
if os.path.isdir(file) == True:
filelist2 = os.listdir("/Users/stevengooday/Desktop/Alexa/TWTD")
zipfile(file)
# loop around all file
# listfiles()
def traverseDirectory():
rootDir = '/Users/stevengooday/Desktop/Alexa/TWTD'
for dirName, subdirList, fileList in os.walk(rootDir, topdown=False):
for fname in fileList:
print('\t%s' % fname)
zipfile(fname)
traverseDirectory()