A simple python script that helps to backup files/ folder.
Configuration is just a simple csv file (files.csv) with source and destination.
- Source
- If file is provided, script will only backup a single file
- If a folder is provided, script will backup the whole folder recursively
- Destination
- If folder is provided, script will backup provided folder
- If none is provided, script will automatically backup based on
BACKUP_DIR
(defaulted to./backup
directory)
The following configuration can be updated according to preference, configuration is located on top of backup.py
- SOURCE_FILE (defaulted to 'files.csv')
- BACKUP_DIR (defaulted to './backup')
- DATE_TIME_FORMAT (defaulted to '%Y%m%d %H%M%S')
- Install python
- Download backup.py
- Move to desired location
- Executing script by running
python backup.py
- script will automatically asked for source and destination for initial setup (if files.csv not found)
- Run
crontab -e
- When prompted editor use
nano
- When prompted editor use
- Insert the following
0 21 * * * /usr/bin/python3 /home/linux/git/backup-python/backup.py
- Save the file
- NOTE: use
select-editor
to change editor accordingly