Skip to main content

Synchronizes source and replica folders

Project description

software-version software-state PyPI version

software-owner owner-contact: ivan.rafa.16@gmail.com

sync$\color[rgb]{0,0.67,0.2} 2$folders

This is a simple program that synchronizes two folders: source and replica. The program maintains a full, identical copy of source folder at replica folder. The program is written in Python.

The program is designed to be run from the command line. It takes four arguments: source folder path, replica folder path, synchronization interval and logs path. The program synchronizes the folders every time the interval expires. The program logs file creation/copying/removal operations to a file and to the console output.


Features

  • Synchronization is one-way: after the synchronization content of the replica folder is modified to exactly match content of the source folder;
  • Synchronization is performed periodically;
  • File creation/copying/removal operations are logged to a file and to the console output;
  • Folder paths, synchronization interval and log file path are provided using the command line arguments;

Quick Start

      Get The Script From Git Hub Repo

Inside a folder of your choice, clone the repository from command line:

git clone https://github.com/ivanSantos16/sync2folders

You can run the program from the command line and ask for help with the script variables:

python sync2folders -h                                                                             

usage: synchronisation.py [-h] -s SOURCE -r REPLICA -p PERIOD -l LOGS

Synchronizes two folders: source and replica

options:
  -h, --help            show this help message and exit
  -s SOURCE, --source SOURCE
                        Source folder path
  -r REPLICA, --replica REPLICA
                        Replica folder path
  -p PERIOD, --period PERIOD
                        Period of time in seconds between each synchronization
  -l LOGS, --logs LOGS  Logs file path

Arguments Description

  • source : Source folder path (required) [string]
  • replica : Replica folder path (required) [string]
  • period : Period of time in seconds between each synchronization (required) [int]
  • logs : Logs file path (required) [string]

Different examples of running the program.

First example:

python sync2folders -s <source_folder_path> -r <replica_folder_path> -p <sync_interval> -l <log_file_path>
python sync2folders -s source -r replica -p 10 -l logs/logs.txt

Second example:

python sync2folders --source <source_folder_path> --replica <replica_folder_path> --period <sync_interval> --logs <log_file_path>
python sync2folders --source source --replica replica --period 10 --logs logs/logs.txt

      Get The Script From Pypi

From command line, install the package with pip:

python -m pip install sync2folders

From anywhere, you can run the program from the command line and ask for help with the script variables:

python -m sync2folders -h                                                 

usage: synchronisation.py [-h] -s SOURCE -r REPLICA -p PERIOD -l LOGS

Synchronizes two folders: source and replica

options:
  -h, --help            show this help message and exit
  -s SOURCE, --source SOURCE
                        Source folder path
  -r REPLICA, --replica REPLICA
                        Replica folder path
  -p PERIOD, --period PERIOD
                        Period of time in seconds between each synchronization
  -l LOGS, --logs LOGS  Logs file path

Arguments Description

  • source : Source folder path (required) [string]
  • replica : Replica folder path (required) [string]
  • period : Period of time in seconds between each synchronization (required) [int]
  • logs : Logs file path (required) [string]

Different examples of running the program.

First example:

python -m sync2folders -s <source_folder_path> -r <replica_folder_path> -p <sync_interval> -l <log_file_path>
python -m sync2folders -s source -r replica -p 10 -l logs/logs.txt

Second example:

python -m sync2folders --source <source_folder_path> --replica <replica_folder_path> --period <sync_interval> --logs <log_file_path>
python -m sync2folders --source source --replica replica --period 10 --logs logs/logs.txt

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sync2folders-1.0.2.tar.gz (6.8 kB view hashes)

Uploaded Source

Built Distribution

sync2folders-1.0.2-py3-none-any.whl (9.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page