How do I sync files between two drives?
You can use rsync
for that.
NAME
rsync - a fast, versatile, remote (and local) file-copying tool
Example:
rsync -av "/path/to/source" "/path/to/destination"
Note: Where "/path/to/source"
is the path of source directory and "/path/to/destination"
is the path to directory which contains destination directory. For example of you want to make synchronization between /media/users/disk1/dir
(as source) and /media/disk2/dir
(as destination), then you should run rsync -av "/media/users/disk1/dir" "/media/disk2/"
If you want to delete extraneous files from destination, you can use
--delete
option as follows:rsync -av --delete "/path/to/source" "/path/to/destination"
If you want to show the progress during transfer then use
--progress
as follows:rsync -avh --progress --delete "/path/to/source" "/path/to/destination"
There is also
--info=progress2
available for outputs statistics based on the whole transfer.
Note: For more information on rsync
visit (man rsync
) manpage and list of options. You can also use a GUI front-end.
You can also use Lsyncd.It will monitor continuously your mentioned directory tree and when changes happened it will automatically apply the changes.
It is actually similar to Rsync. You can use it for remote sync with SSH+Rsync. The hyperlink is its help page and it can give you more information.
Answer for your question:
lsyncd -rsync /path/directory1 /path/directory2