• 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: Jerry Krinock <email@hidden>
  • Date: Fri, 10 Jun 2011 12:51:31 -0700

You should be able to figure it out by modifying my code here which adds tildes or hashes.  This is in a category of NSString.

- (NSString*)pathSuffixedWithString:(NSString*)suffix {
    NSString* newPath = self ;
    do {
        newPath = [[[newPath stringByDeletingPathExtension]
            stringByAppendingString:suffix]
            stringByAppendingPathExtension:[self pathExtension]] ;
    } while ([[NSFileManager defaultManager] fileExistsAtPath:newPath]) ;

    return newPath ;
}

- (NSString*)tildefiedPath {
    return [self pathSuffixedWithString:@"~"] ;
}

- (NSString*)hashifiedPath {
    return [self pathSuffixedWithString:@"#"] ;
}


_______________________________________________

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: changing file name when copying a file in the same directory
      • From: Jens Alfke <email@hidden>
References: 
 >changing file name when copying a file in the same directory (From: Sandeep <email@hidden>)

  • Prev by Date: Re: changing file name when copying a file in the same directory
  • Next by Date: NSFileHandle and Data Integrity
  • Previous by thread: Re: 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