Skip to content

Instantly share code, notes, and snippets.

@SEVEZ
Last active April 11, 2017 09:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SEVEZ/f011bf52a4247e011d7556169363b948 to your computer and use it in GitHub Desktop.
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
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()
@SEVEZ
Copy link
Author

SEVEZ commented Apr 11, 2017

Need to create Dropbox token beforehand

https://www.dropbox.com/developers/apps/create

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment