Last active
April 11, 2017 09:47
-
-
Save SEVEZ/f011bf52a4247e011d7556169363b948 to your computer and use it in GitHub Desktop.
Get Dropbox links for all files in the directory, where bat files is located -- created by FABIS.XYZ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set VAR_1=%~dp0 | |
C:\Python27\python.exe C:\Dropbox\Projects\NameGenerator.py %1 %VAR_1% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dropbox | |
import sys | |
from os import walk | |
currPath = sys.argv[0] | |
file = open('C:\Dropbox\Projects\links.txt', 'w+') | |
try: | |
files = [] | |
dpath = None | |
for (dirpath, dirnames, filenames) in walk(sys.argv[1]): | |
files.extend( filenames ) | |
dpath = dirpath | |
break | |
files.pop(files.index('getlinks.bat')) | |
for f in xrange( len(files) / 2 ): | |
file.write( files[f].rsplit('.',1)[0].replace('_', ' ') + '\n' ) | |
vidPath = dpath.replace("\\",'/') + files[f] | |
mayaPath = dpath.replace("\\",'/') + files[f+len(files)/2] | |
linkV = dropbox.client.DropboxClient('V04gT06019c*******B4PtgH2P8pWoNtWKIKRltxGbADkSe32_WYTi-N-3M_ykcl').share( vidPath.split('Dropbox',1)[-1], short_url=False) | |
linkM = dropbox.client.DropboxClient('V04gT06019c*******B4PtgH2P8pWoNtWKIKRltxGbADkSe32_WYTi-N-3M_ykcl').share( mayaPath.split('Dropbox',1)[-1], short_url=False) | |
file.write( 'Maya 2015:' + '\n' ) | |
file.write( linkM['url'] + '\n' ) | |
file.write( 'Preview:' + '\n' ) | |
file.write( linkV['url'] + '\n' ) | |
file.write( '\n' ) | |
finally: | |
file.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Need to create Dropbox token beforehand
https://www.dropbox.com/developers/apps/create