rsync(
remote sync) is a utility for efficiently transferring and synchronizing files between a computer and an external storageCopy or sync files locally:
rsync -zvh [Source-Files-Dir] [Destination]
Copy or sync directory locally:
rsync -zavh [Source-Files-Dir] [Destination]
Copy files and directories recursively locally:
rsync -zrvh [Source-Files-Dir] [Destination]
Sample python code script to do a backup using python...
#!/usr/bin/env python
import subprocess
from multiprocessing import Pool
from os import walk
src= "/home/user/data/"
dest="/home/user/data/backup/"
def backupData(dir):
print("dir = "+ src+dir +" dest = " + dest+dir)
subprocess.call(["rsync", "-arq", src+dir, dest+dir])
dirList = []
for (root, dirs, files) in walk(src):
dirList.extend(dirs)
break;
print (dirList)
p= Pool(len(dirList))
p.map(backupData, dirList)