#!/usr/bin/env python import subprocess from multiprocessing import Pool import os src = "/home/student-03-474f458f89e0/data/prod" dest = "/home/student-03-474f458f89e0/data/prod_backup" def run_sync(file): print(os.path.join(dest,file)) subprocess.call(["rsync", "-arq", os.path.join(src,file), os.path.join(dest,file)]) if __name__ == "__main__": files = os.listdir(src) p = Pool(len(files)) p.map(run_sync, files)
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter