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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file sync2folders-1.0.2.tar.gz.

File metadata

  • Download URL: sync2folders-1.0.2.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.10.7 Windows/10

File hashes

Hashes for sync2folders-1.0.2.tar.gz
Algorithm Hash digest
SHA256 cf5a8d91b776433b17c151fb86b43c44bbbbc6f8e3b72c4530de87dbbecc90db
MD5 982ffcde6b6acbb4d213b0d21233ea7c
BLAKE2b-256 8646080bdce4d496c2f413dd510ee22ecb960896b31b63ed133e3a1fff6f86b9

See more details on using hashes here.

File details

Details for the file sync2folders-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: sync2folders-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.10.7 Windows/10

File hashes

Hashes for sync2folders-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a085af87fd6f549e9682ff7042637e87b7aad076bd83ac7c4ad0c6571294742f
MD5 977be4972ee2f3d584a9146b4721ae1d
BLAKE2b-256 30ee80393e3411579b1e2fb8e9fcd62cda85c5a29f698e7a2297ff818fbad08c

See more details on using hashes here.

Supported by

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