LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   MV command not removing source on move to network share (https://www.linuxquestions.org/questions/linux-newbie-8/mv-command-not-removing-source-on-move-to-network-share-4175509795/)

Kgeil 07-01-2014 03:38 PM

MV command not removing source on move to network share
 
Hi, I'm guessing this is a really simple question, but I can't find anything in the man pages or google, so:

I used the mv command to move a large directory (14 Gb with subdirectories) to a network share. The files copied, but did not remove the source files. Is this because it's a network move, or a move to a different filesystem?
Does anyone know of a way to ensure that the source files get removed?

Thanks!


Kevin

suicidaleggroll 07-01-2014 03:42 PM

My guess is your user has read permission on the source files/dirs but not write permission. So while it was able to copy the files, it was not able to remove the originals since you don't have the permission to do so. Were there any errors printed on the terminal?

In my experience, when moving a large directory like that, it's a much better idea to use "rsync -a" to copy it to the destination, and once you've verified it's there and everything works correctly, you can remove the source manually. This way if there's a network interruption, system interruption, power outage, etc. you can always pick up the copy where it left off without risking some files not making the transfer. If the transfer gets interrupted part way through you just run it again, whereas with an mv there are always questions. Which files/dirs have been fully transferred? Which have been partially transferred? Which ones do you want to move again to overwrite what's there? Are there any dirs on the destination that have already been moved over and deleted off the source? Or are they still on the source? etc. You also separate the copy from the deletion, so in case there are write permission issues like I mentioned could be the case here, you don't run into it until you go to delete, after you're already sure everything has been copied over properly.

Kgeil 07-01-2014 04:00 PM

Thanks, I had just been thinking "maybe there's a better way"... I'll look into rsync and tar for my moves.

Thanks!


Kevin


All times are GMT -5. The time now is 05:06 PM.