Skip to content

jupihes/upload-to-Dropbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Copy changed file and upload to Dropbox

Simple python script for Windows to do following for predefined list of files

  1. Daily xcopy your files to specific folder
import subprocess
srcs = [r"C:\Users\<username>\Desktop\Document 1.pdf",
       r"C:\Users\<username>\Desktop\Document 2.pdf",
       r"C:\Users\<username>\Desktop\Document 3.txt",
       r"C:\Users\<username>\Desktop\Document 4.xlsx"]
dst = r"D:\...\Xcopy folder\\"

for i in srcs:
    subprocess.call(["xcopy", src, dst,"/s", "/d"])
  1. Upload list of files to DropBox
import dropbox
# Get your app key and secret from the Dropbox developer website
access_token = '**'

def upload_file(file_from, file_to):
    dbx = dropbox.Dropbox(access_token)
    f = open(file_from, 'rb')
    dbx.files_upload(f.read(), file_to)

# sample list of files to be uploaded
L = ["F:\M\W\SQL sample.sql",
     "E:\R\M\Email list.txt"]

for i in L: # for i in list of files:
    file_from = i  #//local file path
    # i.split('\\')[-1] == file name

    file_to = '/Folder name/' + i.split('\\')[-1]      #// dropbox path
    upload_file(file_from,file_to)
  • Upload only if there is a change in files [To be added]

About

simple scripte to upload files to DropBox

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages