1. Syncing from Local to Remote (Upload)
Command:
BASH
rsync -avuz /root/ocr/ root@connect.yza1.seetacloud.com:/root/autodl-tmp/ocr/ocr/
Parameter descriptions:
-a: Archive mode; recursively transfers files while preserving symbolic links, permissions, timestamps, etc.-v: Show detailed output (optional).-u: Only sync files that are newer in the source than in the destination.-z: Compress data during transfer to reduce bandwidth usage./root/ocr/: Local source directory.root@connect.yza1.seetacloud.com:/root/autodl-tmp/ocr/ocr/: Remote target directory.
Explanation
This syncs the contents of the local /root/ocr/ directory to /root/autodl-tmp/ocr/ocr/ on the remote server, copying only newer files with compression and detailed output.
2. Syncing from Remote to Local (Download)
Command:
BASH
rsync -auvz -e "ssh -p 22505" root@connect.yza1.seetacloud.com:/root/autodl-tmp/ocr/ocr/ /root/ocr/
Parameter descriptions:
-a: Archive mode; recurses and preserves file attributes.-v: Show detailed output.-u: Only sync files that are newer in the source than in the destination.-z: Compress data during transfer.-e "ssh -p 22505": Use the SSH protocol and connect via port 22505.root@connect.yza1.seetacloud.com:/root/autodl-tmp/ocr/ocr/: Remote source directory./root/ocr/: Local target directory.
Explanation
This syncs files from /root/autodl-tmp/ocr/ocr/ on the remote server to the local /root/ocr/ directory, copying only newer files, connecting via the specified SSH port, and compressing the transferred data.
3. Common Options
-a: Archive mode (recursive transfer, preserve file attributes, etc.).-v: Verbose output.-u: Only sync newer files.-z: Compress data.-e: Specify the remote shell (e.g., an SSH connection).--delete: Delete files in the destination directory that do not exist in the source directory (use with caution).
4. Summary
| Operation | Syncing from Local to Remote | Syncing from Remote to Local |
|---|---|---|
| Command | rsync -avuz /root/ocr/ root@...:/root/ocr/ocr/ | rsync -auvz -e "ssh -p 22505" root@...:/ocr/ocr/ /root/ocr/ |
| Direction | Local → Remote | Remote → Local |
| Parameters | -a archive mode, -v verbose, -u update, -z compression | -a archive mode, -v verbose, -u update, -z compression, -e specify SSH |
| Description | Sync the local /root/ocr/ to the remote /root/ocr/ocr/ | Sync from the remote /root/ocr/ocr/ to the local /root/ocr/ |