• 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: Best way to move a file out of the way?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Best way to move a file out of the way?


  • Subject: Re: Best way to move a file out of the way?
  • From: Marco S Hyman <email@hidden>
  • Date: Tue, 24 Mar 2015 18:46:33 -0700

> If renaming is the answer, is there any sample code to do this safely, taking care of all cases?  (For example, replacement name already taken, or adding an extension if the file doesn’t start with one, etc.)

An idea... move the destination file, if it exists, to the trash.
See NSFileManager's trashItemAtURL:resultingItemURL:error: to do that in a
safe manner.   Trash the old file then save the new.

Marc
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Best way to move a file out of the way?
      • From: Daryle Walker <email@hidden>
References: 
 >Best way to move a file out of the way? (From: Daryle Walker <email@hidden>)

  • Prev by Date: Re: Best way to move a file out of the way?
  • Next by Date: Storyboard warning: internationalization of (null)
  • Previous by thread: Re: Best way to move a file out of the way?
  • Next by thread: Re: Best way to move a file out of the way?
  • Index(es):
    • Date
    • Thread