News:

The Latest electronic and computer Tips that work!

Main Menu
[Hide Attachments]
There are no attachments!

Using Rsync to move directories

Started by branx86, December 27, 2025, 02:12:58 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

branx86

The rsync command is the best tool for merging directory contents, as it is designed to synchronize files and directories recursively and efficiently, merging contents rather than attempting a direct overwrite of the directory itself.

-a: Archive mode, which preserves permissions, ownership, timestamps, and recursively copies directories.
-v: Verbose output (optional, but helpful to see progress).

rsync -av /path/to/source_dir/ /path/to/destination_dir/
same command using copy (cp)
cp -r /path/to/source_dir/* /path/to/destination_dir/



After using rsync to merge the contents, you can safely remove the original source directory using rm -rf.


rm -rf /path/to/source_dir