Recover files from the Trash

Hi, ALL,

Is there an API in Cocoa Objective-C that will allow restore file(s) from Trash? And possibly get the list of files inside the Trash...

Thank you.

Is there an API in Cocoa Objective-C that will allow restore file(s) from Trash?

No.

Back in the day there was a supported way to determine the original location of a trashed item (see putAwayFolderID in <Files.h>) but that is no longer in use.

And possibly get the list of files inside the Trash...

Not really.

Keep in mind that the Trash is a concept synthesised by the Finder; it doesn’t actually exist in reality. So, while it’s possible to locate the Trash directory for your user on a specific volume [1], there’s no good way to generate a coherent view of the trash from that info.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] Using FileManager.url(for:in:appropriateFor:create:) with the .trashDirectory selector.

Is it possible to restore the files from Trash?

What about my previous answer was unclear?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Recover files from the Trash
 
 
Q