Giter Site home page Giter Site logo

dropbox-delete-folder-script's Introduction

The script

This repo contains a script (DbxDeleteFolderScript.py) which is meant for periodically deleting a folder from Dropbox (by means of a Cronjob). It writes its state to a file 'last_run' which it will create the first time. The script is also capable of catching up after not having run for a while. The folders it deletes need to have a name that can be related to a date (e.g. 2020-07-14). For the first use it is necessary to run this script manually in order to set the app key and refresh token. For this, this repo also contains a helper class (DbxTokenService) which facilitates this. After that, it can run any time without any user interference.

Created by: Laurens van der Kooi

Installing dependencies

Install the following packages:

pip install dropbox
pip install isodate

Setting up Cronjobs

First, make python script executable:

chmod +x ./DbxDeleteFolderScript.py

Change the shebang line as needed:

  • On OS X, the shebang line is #! /usr/bin/env python3.
  • On Linux, the shebang line is #! /usr/bin/python3 (this one is already provided in the script).

Check if the script runs (you might need to reformat the script with dos2unix in your Linux-based terminal, as shown below).

dos2unix ./DbxDeleteFolderScript.py

Then in terminal:

crontab -e

and

On MacOs:

PATH = /Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/bin:/usr/bin:/bin
52 16 * * * /Users/laurensvanderkooi/PycharmProjects/DropBoxScripting/DbxDeleteFolderScript.py

On Linux:

52 16 * * * /Users/laurensvanderkooi/PycharmProjects/DropBoxScripting/DbxDeleteFolderScript.py

dropbox-delete-folder-script's People

Contributors

lvdkooi avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.