• 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: Renaming and moving files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Renaming and moving files


  • Subject: Re: Renaming and moving files
  • From: Michael Gersten <email@hidden>
  • Date: Tue, 12 Mar 2002 23:20:49 -0800

Rename is an atomic operation.

Recurisve copying is NOT atomic -- because of the time it takes, in a
multitasking environment, you may end up with a munged copy without
knowing it.

Rename doesn't affect any of the timestamps of files.
Recursive copying must alter at least the ctime (inode
creation/alteration time).

Rename works even if you can't read or write subdirectories.
Recursive copying does not.

Rename won't destroy set-uid or set-gid bits
Recursive copy will.

Rename won't alter ownership of files
Recursive copy will.

Rename works with no free disk space.
Recursive copy won't.

Anything else?

Ondra Cada wrote:
>
> Chris,
>
> >>>>>> Chris Parker (CP) wrote at Fri, 8 Mar 2002 10:42:49 -0800:
> CP> >They differ. movePath:toPath: does always copy (actually I think it's a
> CP> >grave bug, but there might be reasons which I've missed).

I'd have to agree. movePath:toPath: should do a rename if it can, and
a copy only as fallback. There are a lot of things that can go wrong
in recursive copies.

> CP> movePath:toPath:handler: copies to allow graceful error recovery for
> CP> copies, basically. If something goes south, the original should be
> CP> present in its untouched form.
>
> Which is exactly what rename does, is it not?
>
> Perhaps I am wrong, and shame on me if so, but I've always thought that
> rename is an atomic operation, which can only succeed (in which case the new
> name exists and is all right), or fail (in which case the original name
> exists and is all right). At the very least, I haven't ever encountered
> anything else.
> ---
> Ondra Cada
> OCSoftware: email@hidden http://www.ocs.cz
> 2K Development: email@hidden http://www.2kdevelopment.cz
> private email@hidden http://www.ocs.cz/oc
_______________________________________________
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: Renaming and moving files (From: Chris Parker <email@hidden>)

  • Prev by Date: OT (joke: was: NSWindowWillCloseNotification)
  • Next by Date: Serious class cluster/toll free bridging question (was: Newbie (to Cocoa) questions)
  • Previous by thread: Re: Renaming and moving files
  • Next by thread: Re: Renaming and moving files
  • Index(es):
    • Date
    • Thread