I'm currently using Ubuntu 22.04 and I have all my movies stored in /home/myuser/Videos/Movies, organized by individual folders. I'm trying to move everything from this Movies directory to /media/Videos/Movies. I ran the command `mv -v /home/myuser/Videos/Movies/ /media/Videos/Movies`, but it ended up placing the files in /media/Videos/Movies/Movies instead. Also, it filled up the drive since it seems to be copying the files instead of moving them. When I tried moving a single folder with the command `mv -v /home/myuser/Videos/Movies/MovieTitle /media/Videos/Movies`, it worked perfectly. I'm wondering if there's a way to move the entire contents of the directory without temporarily duplicating the files and causing space issues.
2 Answers
Make sure you're directing your files correctly! When you use `mv`, if your target is a directory, it assumes you want to move everything inside that directory. You might want to run `mv -v /home/myuser/Videos/Movies/* /media/Videos/Movies` instead, which only transfers the files and folders without nesting them. Also, check if `/media` is on the same partition as your home directory; you could be having issues because it's not.
You're right about `mv` duplicating before deleting, which helps prevent file loss. If both directories are on the same disk, this behavior can cause space issues. Instead, using `rsync -av --remove-source-files /home/myuser/Videos/Movies/ /media/Videos/Movies` could be a better option since it moves files more efficiently and manages space better. It sounds like that's what you ended up trying and it worked!
Yes, I switched to rsync after seeing your suggestion! It's much smoother and exactly what I need.
Gotcha, I ran it with the asterisk and it worked like a charm! Thanks for the tip!