Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I would like to merge the contents of two folders with the same same, from the linux terminal.

Drive 1\Folder

Drive 2\Folder

I want all files and sub-files in drive 1's folder to go to drive 2's folder, i tried to use MV and i got an error saying:

unable to remove target: Is a directory

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

cp -r Drive\ 1/Folder/* Drive\ 2/Folder/

I always prefer to cp rather than mv as it means I still have a copy of the original if in case something happens in the transfer.

After the copy is complete you can rm -r Drive\ 1/Folder.

This should also deal with the issue mv is having with moving the directory.

Hope that helps

share|improve this answer
    
thanks will mark as answer when 10 mins is up!!!! –  Taylor Gibb Sep 30 '12 at 19:45
1  
Copying also sets the SELinux properties of the files being moved. The 'mv' command maintains the previous properties which can lead to confusing behavior in services and difficulties in accessing files otherwise completely correct permissions. –  Magellan Sep 30 '12 at 22:02
add comment

Using cp -ru drive1/* drive2 will copy everything in drive1 to drive2. The -r means to copy recursively. The -u means to update by copying only when the source file is newer than the destination file or when the destination file is missing.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.