How to access files in the recycle bin?

Can we access to the trash files to delete them ourselves (for example with rm -P) ?

Var f As FolderItem = SpecialFolder.Trash(Volume(0))


MBS has plugins to access the trash.


Cleaning the Trash in MacOs works like this
i = DeleteEntireFolder(SpecialFolder.Trash, false)

where “DeleteEntireFolder” is a method from EXAMPLES and Integer i ist the returned ERRcode

In WIN you have first to check the path to the Trashfolder on Your individual System, responding to the User.

Please note that on the Mac, your application may not have the privileges to access the Trash/Bin, let alone delete any files from it.

If you come across a Mac installation that you cannot remove files, you will need to use a privilege escalation solution, while there are a handful which currently work, there are only a couple that are considered supported by Apple, and they’re a PITA to deal with.

NEVER use a shell class and call “rm” as this is not only a security risk (if your application is compromised). But also if your application accidentally passes a corrupted or incorrect string to the shell, you run the risk of deleting something else entirely. Instead walk the path with folderitems and use the built-in functions for removing files as much as possible.

At this point, you may consider a different strategy… What if you do not write the files you sent to the Trash ?

Why don’t you use the Temporary Folder and let the OS delete them by itself ?

If the app is sandboxed, chances are the shell won’t work anyway.

I read on the net that the "rm -P " command overwrites the file 3 times. off by typing the command
“man rm”, in the Terminal, i read this :

-P This flag has no effect. It is kept only for backwards
compatibility with 4.4BSD-Lite2.

Can someone confirm for me?

Delete a file only clears (part of) the entry in the mass storage catalog. (1)

To really delete a file, you have to whipe it (write 00 into the file locations blocks).

So, with a simple utility application, you can restore any “deleted” file.

You are in a wrong path pal.

Specifically, it removes the number of entries in the catalog and “free” the blocks the file data are (set them as free).

This is why there is two ways of formating a hard disk (not a SSD, HDD only): the slow one who simply clears all entries and set the Blocks Allocation Table to free (and tooks less than a minute) and the other one (low level format) who takes hours with nowadays hard disk size…
An utility can restore the hard disk formated using the “less than a minute format” while the low level format is not restorable at all…