• 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: changing file name when copying a file in the same directory
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: changing file name when copying a file in the same directory


  • Subject: Re: changing file name when copying a file in the same directory
  • From: Jens Alfke <email@hidden>
  • Date: Fri, 10 Jun 2011 12:22:01 -0700

On Jun 10, 2011, at 12:07 PM, Sandeep wrote:

> where in if a user copies a file in the same directory then a new file is created with the sufix Copy 1, Copy 2, Copy3 etc. can someone please let me know if we can implement the same using NSFileManager or if there are any methods that help in doing the same.

I don’t know of anything that will do this for you. Basically you have to write a loop where you try to copy the file, and if you get an error that the destination filename exists, you append the next suffix to it and try again.

—Jens

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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

References: 
 >changing file name when copying a file in the same directory (From: Sandeep <email@hidden>)

  • Prev by Date: Re: NSInputStream created from NSData - expected it to close at end of data, did not happen
  • Next by Date: Re: changing file name when copying a file in the same directory
  • Previous by thread: changing file name when copying a file in the same directory
  • Next by thread: Re: changing file name when copying a file in the same directory
  • Index(es):
    • Date
    • Thread