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 ~/ Quote:
|
typically a -r or -R are used for recursive. try one of those to move the directory. or just cp -r
|
-r -R
seem to be invalid options for the mv command. |
You can try to copy the content of the source directory into the destination directory, then - if succeed - remove the original, for example:
Code:
cp -R /mnt/camera/picfolder/* ~/picfolder |
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 :) Hope I could clear up your confusion a little |
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 :cool:
thankyou for your more indepth explaination ischi :) |
Quote:
|
Quote:
|
All times are GMT -5. The time now is 09:01 PM. |