Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Slackware 12.1, AND IM LOVIN EVERY MINUTE OF IT, JERRY! :D
Posts: 122
Rep:
replacing folder with mv command
yow,
when i try to move the pictures folder from my camera to my home dir, i use this command
Code:
mv -f /mnt/camera/picfolder ~/
i get this error
Quote:
inter-device move failed, unable to remove target: Is a directory
now, you may have guessed that a folder of the same name already exists in the home dir, and this is part of the problem, but im wondering why the above commandline does not work and simply overwrite the old folder and its pix with the new folder/pix?
Distribution: Slackware 12.1, AND IM LOVIN EVERY MINUTE OF IT, JERRY! :D
Posts: 122
Original Poster
Rep:
thankyou lleb and colucix.
i did have to use some 'cp' and 'rm' commands in the script instead of the 'mv' command, but its not a big deal, i just wonder why the move command doesnt do all that for me.
ah well, i did achieve what i wanted, so i guess thats the main thing.
The problem here is that the move is across 2 devices, the way mv works (and also way -r Options are not used and/or needed) is by replacing the node in the inode table (first sectors of your drive) which points to the folder by the new one, so actually as long as you stay on the same device no data is actually copied, but only the pointer to it is moved. I'm not going to go in more detail now... If you want to know more check out books about OS/Unix.
Now if you try to move a folder across 2 devices this cant obviously be done but Data has to be moved. So mv has to fall back on actually copying data from one device to another and removing it afterwards, and it cant remove the inode to which to copy because if it would remove it theres nothing to copy to, and if it doesnt remove it it cant copy to it because there is still data there (in short and dirty said ). So thats why you cant mv and hav to copy.
For more info I would check Andrew S. Tannenbaum - Modern Operating Systems
Distribution: Slackware 12.1, AND IM LOVIN EVERY MINUTE OF IT, JERRY! :D
Posts: 122
Original Poster
Rep:
i always suspected the concept of the pointer moving, and not the actual file, because when you move a big file to another part of the file system, its almost instant and theres no sound from the HD. i find that pretty cool
The problem here is that the move is across 2 devices, the way mv works (and also way -r Options are not used and/or needed) is by replacing the node in the inode table (first sectors of your drive) which points to the folder by the new one, so actually as long as you stay on the same device no data is actually copied, but only the pointer to it is moved. I'm not going to go in more detail now... If you want to know more check out books about OS/Unix.
Now if you try to move a folder across 2 devices this cant obviously be done but Data has to be moved. So mv has to fall back on actually copying data from one device to another and removing it afterwards, and it cant remove the inode to which to copy because if it would remove it theres nothing to copy to, and if it doesnt remove it it cant copy to it because there is still data there (in short and dirty said ). So thats why you cant mv and hav to copy.
For more info I would check Andrew S. Tannenbaum - Modern Operating Systems
Hope I could clear up your confusion a little
This make sence, but I still don't understand why it doesn't leave the destination folder intact and continue on moving the sub-folders/files, like when we copy using nautilus using the "merge" option. I guess it has been someting too modern to implement!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.