Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: newb- Overwriting a file or folder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: newb- Overwriting a file or folder




On 1 Jul 2008, at 13:57, Chris Paveglio wrote:

Newb alert.

I'm trying to copy some files and folders from one location to another. I would like to overwrite them at the destination. Is this possible yet?

[theManager copyPath:theSettings toPath:theDestinationFile handler:nil];

I've read the documentation: "The file specified in source must exist, while destination must not yet exist." and also see this older post regarding it: http://www.cocoabuilder.com/archive/message/cocoa/2005/3/30/131694

But that was a while ago (2005). Has this function been added in xCode 3/Obj-C 2? I'm working on 10.4.11 with xCode 2.5 but I also have 10.5/xC3 at home, but I'm not in front of it right now.

FWIW, Applescript makes it incredibly easy:
move folder "Safari" of folder myImport to folder "Library" of folder myUserFolder with replacing


Is the only viable option to force-delete any files/folders already there [removeFileAtPath:handler:]?

Correct, you must first delete them using removeFileAtPath: or send them to the Trash with NSWorkspace. Of course, if this is something your code is doing often, you could write a category method to simplify it.


Thanks, Chris




_______________________________________________

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

_______________________________________________

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: 
 >newb- Overwriting a file or folder (From: Chris Paveglio <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.