Skip navigation.
 
mlRe: Changing file & directory names
FROM : Sherm Pendley
DATE : Sat Jul 01 23:10:56 2006

On Jul 1, 2006, at 3:57 PM, Dean Snyder wrote:

> Sherm Pendley wrote at 3:41 PM on Saturday, July 1, 2006:
>

>> I'm not debating what words are used, I'm pointing out that you've
>> misunderstood them.

>
> Huh?
>
> I insist you are misunderstanding the words, but I am also saying 
> at the
> same time that you may have the right understanding of what is 
> actually
> going on, in spite of what the documentation says. I just don't know -
> all I have to go by is the documentation.


What? You also have commentary from random strangers on the internet 
to go by! Isn't that enough? :-)

> So you're saying that there is no new file creation going on with
> NSFileManager movePath?


Sorry for the Clinton-esque answer, but that depends on precisely 
what you mean by "file creation". A new directory entry is created 
points to the original file's contents. (man 2 link). Then, the 
original directory entry is removed. (man 2 unlink). At no time is 
the contents of the file duplicated, just the directory entries.

Also, keep in mind the limitations of link() - one cannot create a 
link that crosses volumes. So moving a file from one drive to another 
*will* copy the data. Shuffling directory entries is basically just 
an optimization for the very common case of the source and 
destination being on the same volume.

Another thing link() can't do is create a link to a directory. That's 
what the docs are referring to when they talk about recursive 
behavior. Moving a directory actually does mean creating a new one; 
after it's been created, files are moved into it with link()/unlink
(). Rinse and repeat for subdirectories.

> Then why do both the created and modified dates
> of the just "moved" file equal the time of "moving" and not, for
> example, the "real" created time?


That's essentially a policy decision. There's no technical reason why 
that would have to be the case, but obviously someone thought it 
would be a good idea.

> I'm not complaining to you about the documentation - I'm complaining
> about the fact that you said I misunderstood it. I don't believe I 
> have.


Belief is unnecessary - just test it. Dump a huge file on your disk 
somewhere, then use -movePath:toPath:handler: to move it. For a large 
enough file (a CD or DVD image, for instance), it would be 
immediately apparent which is the case - if the file's contents were 
being copied, there would be a noticeable delay.

sherm--

Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org

Related mailsAuthorDate
mlChanging file & directory names Dean Snyder Jul 1, 19:23
mlRe: Changing file & directory names Greg Titus Jul 1, 19:26
mlRe: Changing file & directory names Dean Snyder Jul 1, 19:41
mlRe: Changing file & directory names Sherm Pendley Jul 1, 20:15
mlRe: Changing file & directory names John Stiles Jul 1, 21:18
mlRe: Changing file & directory names Dean Snyder Jul 1, 21:28
mlRe: Changing file & directory names John Stiles Jul 1, 21:40
mlRe: Changing file & directory names Sherm Pendley Jul 1, 21:41
mlRe: Changing file & directory names Sherm Pendley Jul 1, 21:47
mlRe: Changing file & directory names Dean Snyder Jul 1, 21:57
mlRe: Changing file & directory names John Stiles Jul 1, 22:13
mlRe: Changing file & directory names Sherm Pendley Jul 1, 23:10
mlRe: Changing file & directory names Sherm Pendley Jul 1, 23:19
mlRe: Changing file & directory names Rosyna Jul 2, 02:26
mlRe: Changing file & directory names Derrick Bass Jul 2, 02:28
mlRe: Changing file & directory names Sherm Pendley Jul 2, 03:21
mlRe: Changing file & directory names Dean Snyder Jul 2, 03:39
mlRe: Changing file & directory names Chris Suter Jul 2, 03:47
mlRe: Changing file & directory names Dean Snyder Jul 2, 03:54
mlRe: Changing file & directory names Adam R. Maxwell Jul 2, 09:16
mlRe: Changing file & directory names Matt Neuburg Jul 2, 09:27
mlRe: Changing file & directory names Frode Jul 2, 11:17
mlRe: Changing file & directory names John Stiles Jul 2, 18:20
mlRe: Changing file & directory names Sean McBride Jul 4, 18:07
mlRe: Changing file & directory names Adam R. Maxwell Jul 4, 18:41
mlRe: Changing file & directory names Andy Lee Jul 5, 03:11