View Full Version : NSFileManager move files to trash

Jun 2, 2009, 03:49 AM
I want to delete files to Trash using NSFileManager in my program.

However, I am using removefilesAtPath method and this method deletes the file permanently. Is there any option so the the deleted files will go to the Trash?

Jun 2, 2009, 04:15 AM
There is significant discussion on this over at CocoaDev (http://www.cocoadev.com/index.pl?MoveToTrash)...

I'll leave you to read through it and decide on the best method for you! You would have thought there would be a simple answer, but there is not as the Apple supplied method does not always do what you expect...

Jun 2, 2009, 04:18 AM
Thanks for the link. I am taking a look at it :-)

Jun 2, 2009, 06:27 AM
What about the FSMoveObjectToTrashAsync (http://developer.apple.com/documentation/Carbon/Reference/File_Manager/Reference/reference.html#//apple_ref/c/func/FSMoveObjectToTrashAsync) that is mentioned at the bottom of the linked discussion?