Wednesday, October 19, 2022

rsync remote and local file copying command

Copy and overwrite older files only while showing progress:

rsync -rahP --info=progress2 --stats -u /source/folder/'My Folder'/ /destination/folder/'My Folder'/

    --existing              skip creating new files on receiver
    -u, --update            skip files that are newer on the receiver


Ctrl + Z => stop rsync process // -P => (-rahP)

Resume rsync process // fg %[number] – resume job [number]

fg 1 rsync -rahP --info=progress2 --stats -u /source/folder/'My Folder'/ /destination/folder/'My Folder'/


jobs – list the current jobs
fg – resume the job that’s next in the queue
fg %[number] – resume job [number]
bg – Push the next job in the queue into the background
bg %[number] – Push the job [number] into the background
kill %[number] – Kill the job numbered [number]
kill -[signal] %[number] – Send the signal [signal] to job number [number]
disown %[number] – disown the process(no more terminal will be owner), so command will be alive even after closing the terminal.

Cleanup after failed rsync:
find -type f -iname ".*.*.??????" -ls
find -type f -iname ".*.*.??????" -delete
https://www.tectut.com/2021/11/how-to-pause-and-resume-rsync/
https://manpages.ubuntu.com/manpages/trusty/man1/rsync.1.html
https://unix.stackexchange.com/questions/117190/best-way-to-sync-files-copy-only-existing-files-and-only-if-newer-than-target

No comments:

Post a Comment