A program that maintains a replica of a source folder, performing periodic one-way synchronization.
This tool synchronizes two folders by maintaining an exact copy of a source folder in a replica folder. All file operations (creation, copying, removal) are logged both to a file and console output.
- One-way folder synchronization
- Periodic updates at specified intervals
- Operation logging to file and console
- Support for nested folders
- File comparison using MD5 hashing
- Python 3.10+
- Standard library only
python main.py source_folder replica_folder log_folder interval
Where:
source_folder
: Path to source directoryreplica_folder
: Path to replica directorylog_folder
: Path to store log filesinterval
: Time between syncs in seconds
Example:
python main.py ./Source_Folder ./Replica_Folder ./Log_File_Folder 60
The program consists of two main components:
main.py
: Handles command-line arguments and program initializationfolders_sync.py
: Contains the core synchronization logic
The synchronization process:
- Scans source and replica folders
- Identifies files to create, update, or remove
- Performs necessary operations
- Logs all actions
- Waits for specified interval before next sync
VEEAM_TESTTASK_CLA
├── src
│ ├── folders_sync.py
│ └── main.py
├── Log_File_Folder
│ └── sync_log_file.txt
├── Replica_Folder
│ └── test files
├── Source_Folder
│ └── test files
└── README.md
- Log folder must be separate from source and replica folders
- Sync interval must be greater than 0
- Source and replica folders must exist and be different
- Program can be stopped with Ctrl+C
FoldersSync ..> Path : uses
ArgumentParser ..> Path : validates