Table of Contents
Rsync is a very flexible network-enabled syncing tool. It can also refer to the network protocol developed to utilize this tool. Rsync stands for Remote Sync. Normally rsync is used to transfer file from one server (source) to another server (destination).
1) Create some test files with the following commands:
cd ~
mkdir dir1
mkdir dir2
touch dir1/file{1..100}
2) Directory called dir1
with 100 empty files in it.
ls dir1
file1 file18 file27 file36 file45 file54 file63 file72 file81 file90
file10 file19 file28 file37 file46 file55 file64 file73 file82 file91
file100 file2 file29 file38 file47 file56 file65 file74 file83 file92
file11 file20 file3 file39 file48 file57 file66 file75 file84 file93
file12 file21 file30 file4 file49 file58 file67 file76 file85 file94
file13 file22 file31 file40 file5 file59 file68 file77 file86 file95
file14 file23 file32 file41 file50 file6 file69 file78 file87 file96
file15 file24 file33 file42 file51 file60 file7 file79 file88 file97
file16 file25 file34 file43 file52 file61 file70 file8 file89 file98
file17 file26 file35 file44 file53 file62 file71 file80 file9 file99
3) Empty directory called dir2
.
Then,
4) Contents of dir1
to dir2
on the same system, type:
rsync -r dir1/ dir2
The -r option means recursive, which is necessary for directory syncing.
5) Use the -a flag instead:
rsync -a dir1/ dir2
The -a option is a combination flag.
It stands for “archive” and syncs recursively and preserves symbolic links, special and device files, modification times, group, owner, and permissions.
It is more commonly used than -r and is usually what you want to use.
1, Secure
2, Faster
3, Sutable for recurring tasks
As the demand for virtual private servers (VPS) continues to grow, businesses and individuals are faced with a crucial decision:…
Web hosting is a large industry, as many other factors help any web hosting provider to form a company. The…
Welcome to the complete guide to WordPress security best practices in 2024. As technology evolves rapidly, implementing strong security measures…
Hey, wanted to learn about web hosting? Or do you want to start a new website and need hosting? Questions…
In today's digital world, the threat of DDoS attacks has become increasingly prevalent. These types of attacks have the power…