Re: changing file name when copying a file in the same directory
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