Skip to content

The Python program periodically synchronizes two folders, "source" and "replica," aiming to create an exact replica of the source folder within the replica. The synchronization is one-way, ensuring the replica precisely mirrors the source content.

License

jose-l-martins/One-way-FolderSync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

One-way-FolderSync (Folder Synchronization Program)

This Python program provides a simple yet powerful way to synchronize the content of two folders, maintaining an exact copy in a single direction. It includes features such as file modification tracking, checksum verification and periodic synchronization.

Table of Contents

Features

  • Lightweight and Dependency-Free: This synchronization script is designed to be lightweight and does not require any external dependencies. It relies solely on standard Python libraries, making it easy to use and deploy without additional setup.

  • File Synchronization: Keeps the content of a replica folder in sync with a source folder, creating an exact copy in a single direction.

  • Folder Structure Synchronization: Maintains the subfolder structure of the replica folder to match the source folder.

  • Periodic Sync: Automatically performs synchronization at specified time intervals, allowing for hands-free operation.

  • Logging: Logs detailed information about the synchronization process, including file creations, modifications and deletions, to a specified log file and the command line.

  • Checksum Verification: Ensures the integrity of files by verifying their SHA256 checksums, avoiding unnecessary file operations. SHA256 is an industry standard and is collision-resistant.

  • Interrupt Handling: Allows safer interruption of the script and helps avoid data loss or corruption. Warns about the indicated time window for manual user interruption.

  • User-Friendly Command Line Interface: Simple and intuitive command line options for easy configuration.

Prerequisites

  • Python 3.x
  • Standard libraries: os, sys, argparse, time, datetime, shutil, hashlib

Usage

python main.py -s SOURCE_FOLDER -r REPLICA_FOLDER -l LOG_FILE -t TIME_INTERVAL

Options

  • -s, --source: Path to the source folder.
  • -r, --replica: Path to the replica folder.
  • -l, --log: Path to the log file.
  • -t, --time: Time interval between syncs (in seconds).

Example

python main.py -s /path/to/source -r /path/to/replica -l /path/to/log.txt -t 3600

This example synchronizes the content from /path/to/source to /path/to/replica every hour (3600 seconds), with log entries recorded in /path/to/log.txt.

About

The Python program periodically synchronizes two folders, "source" and "replica," aiming to create an exact replica of the source folder within the replica. The synchronization is one-way, ensuring the replica precisely mirrors the source content.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages