jbennet
Moderator
18,523 posts since Apr 2005
Reputation Points: 1,820
Solved Threads: 599
but that moves and renames whilst removing the old file !? :)
majestic0110
Nearly a Posting Virtuoso
1,328 posts since Oct 2007
Reputation Points: 256
Solved Threads: 72
jbennet
Moderator
18,523 posts since Apr 2005
Reputation Points: 1,820
Solved Threads: 599
No, thats actually exactly wrong.
The mv command does not make a new file. Period. The datablocks holding the information remain unchanged. All that happens is that the entry in the directory file that holds the inode information is copied to the new directory, and then the inode information is removed from the old directory.
To demonstrate this; create a file, and change ownership to someone in your group, but first chmod the file to 600. Chmod the directory the file is located in to 770, and make sure that it is owned by your group and/or you.
Create a new directory (770), with the same ownership. Now, technically, you will not have write access to the file (600 owned by Joe). But, since you have permissions to change the inode information contained in both directory listings, you will be able to run an mv command on the file. You will not, however be able to read from that file to perform the cp command. You can mv, but not cp. You have no access to the stored data, just to the inodes pointing to the data. Therefore, you change the location from which those inodes can be accessed, but do not modify the original file. This is a true mv.
omrsafetyo
Junior Poster in Training
58 posts since Apr 2008
Reputation Points: 13
Solved Threads: 9
touche!
I had not thought about that. In that case, you would be correct.
omrsafetyo
Junior Poster in Training
58 posts since Apr 2008
Reputation Points: 13
Solved Threads: 9