• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Um... How do you rename a file?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Subject: Re: Um... How do you rename a file?
  • From: Alastair Houghton <email@hidden>
  • Date: Fri, 26 Mar 2004 09:48:20 +0000

On 26 Mar 2004, at 00:45, Dustin Voss wrote:

> On 25 Mar, 2004, at 4:29 AM, Alastair Houghton wrote:
>> I take your point about the fact that you aren't really moving the
>> file
>> so you don't expect to have to use a method called "move". But I'm
>> sure you can see that renaming a file is just a special case of the
>> move operation in which you don't change the directory that it's in
>> ---
>> i.e. there's no need for a separate rename operation.
>
> I can see where's he's coming from. Files have a unique id, so if you
> delete a file and recreate it with the same name, you'll have a
> different unique id. The only reason it works is because the mv
> command doesn't delete and recreate the file on HFS+.

This is only true on some filesystems. The FAT family, for instance,
doesn't have unique IDs at all. Also, inode numbers on UNIX have
slightly different semantics to the file IDs on HFS/HFS+ (if I remember
correctly, inode numbers identify the *content* of the file or
directory as opposed to its directory entry... the major difference
being that hard links all get the same inode number, whereas in HFS+
they'd have different file IDs).

I do see what you mean, though. Perhaps the docs could be re-worded in
a more appropriate manner, maybe along the lines of the text in SUSV3,
which says that the "mv" command performs an equivalent action to the
rename() function, with the sole exception that if rename() would have
failed with errno EXDEV (i.e. if it fails because it can't rename
across filesystems), then it can do something else (e.g.
create-copy-delete) instead.

Kind regards,

Alastair.

--
http://www.alastairs-place.net

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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: Ken Tozier <email@hidden>)
 >Re: Um... How do you rename a file? (From: Alastair Houghton <email@hidden>)
 >Re: Um... How do you rename a file? (From: Dustin Voss <email@hidden>)

  • Prev by Date: Re: Um... How do you rename a file?
  • Next by Date: Re: NSValueTransformer used with table colulms
  • Previous by thread: Re: Um... How do you rename a file?
  • Next by thread: Re: Um... How do you rename a file?
  • Index(es):
    • Date
    • Thread