Merging directories in command line in Linux is a pain because the native mv
command will not allow recursive overwriting. So if we want to merge two directories, a lot of people like to suggest either using cp
or rsync
to copy over files and then delete the source files. Another way is to use a shell command to recursively run the move operation on each file in the source directory and mv
it to the destination directory/subdirectory. I like this approach more because then you can add in arbitrary rules for which files to copy.
Continue Reading