Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Um... How do you rename a file?



On 25.3.2004, at 13:50, Stephane Sudre wrote:

Le jeudi, 25 mar 2004, ` 12:47 Europe/Paris, Ken Tozier a icrit :
I'll try that, thanks.

I don't understand why you rule out movePath:toPath? It seem to me
that it is the equivalent of a "mv" shell command, which is a rename
operation, as well as a move operation. Isn't it obvious that
"destination must not yet exist", if you're going to rename a file?

I'm not a unix guy, so, to me, move (or mv) means physically transfer a
file to a completely different location.

The documentation states two things which seem in clear conflict (or at
least extremely wasteful) as I read it

1. "the method CREATES a file at destination that holds the exact
contents of the original file and then DELETES the original file"
2. The file specified in source must exist, while destination must not
yet exist.

This says to me that the system creates a new file at destination and
copies the entire contents no matter how many tens or hundreds of
megabytes it might be, then deletes the original. I'm sure it's not,
but that how it reads. Contrast that with:

[aFile setName:@"jim bob"]

Done. Much easier and much more intuitive than moving a file you're not
really moving.


mv is not moving a file. It's creating a hard link and then remove the link at the previous location.

mv = link + unlink
_______________________________________________

Where link = a filename in the directory (that is a collection of names, i.e. links to files, with pointers to file data) This can be regarded as creating a file and deleting a file, respectively, as described in the documents.
!
! Jyrki Wahlstedt
! Viialankatu 15 as 8 mob. +358-40-502 0164
! FI-32700 Huittinen
!
! Our life is no dream; but it ought to become one and perhaps will.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Re: Um... How do you rename a file? (From: Stephane Sudre <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.