# How to run the completed project ## Prerequisite The application has only been tested on Python 3.7.3 x86_64 on Windows. However, I don't see why it wouldn't work on *NIX as well. Note that Windows' default conhost terminal emulator may have problem displaying unicode characters. I personally run it in PyCharm CE or Visual Studio Code Terminal. 1. Create a [virtual environment](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/) and activate it (optional / recommended) ``` python3 -m venv /path/to/new/venv *NIX: source /path/to/new/venv/bin/activate Windows: C:\path\to\new\env\Scripts\activate ``` 1. Install dependencies requirements. ```Shell pip install -r requirements.txt ``` If you don't like to install packages to global/user scopes, you can also setup [virtual environment](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/) 1. Navigate to `conf/` directory and make a copy of each `.sample.json` files renaming each to remove `.sample` (ie, rename the copy to `sync_settings.json`). Edit those files to populate the correct values. ## Run the code Run `main.py` in the terminal to start the application. The program accept three optional positional parameters - Remote ItemID (such as `87654321012`). This can be found on the URL when browsing on box.com website. User's root directory is `0`. If not provided, will use jobs in `sync_settings.json`. - Local directory that will represent the remote directory. Leave empty or use `.` for working directory (not tested). See `--help` for more information. To change logging level, edit `setup.py` file. When file conflict occurs, if the file size is different, the program downloads remote and overwrite local copy. `blacklist` currently accepts path to file or directory with [Unix shell-style wildcards](https://docs.python.org/3/library/fnmatch.html), all relative to root of remote. The same blacklist currently apply to every drive root. ## Explaining remote directory (to update) For example ``` RemoteRoot of 87654321012 ├───A │ ├───A1.png │ └───A2.png ├───B.jpg └───C │ ├───C1.png │ └───C2.png ├───D.jpg └───E └───E1.png ``` If the following blacklist is applied, ```json { "blacklist": [ "A/A2.png", "C", "D.jpg", "E/E1.png" ], ... } ``` the program will only concern these. ``` RemoteRoot of 87654321012 ├───A │ └───A1.png └───B.jpg ``` Launching the program with `./main.py 87654321012 D:/BoxFolder` will results in ``` D: └───BoxFolder ├───A │ └───A1.png └───B.jpg ``` Launching the program with `./main.py 87654321012 D:/BoxFolder` will results in ``` D: └───BoxFolder └───A1.png ``` Note that the blacklist is still relative to remote root, not `A`. ## Development: Making changes When installing / updating dependencies, update requirements.txt `pip freeze > requirements.txt`