When you drag and drop a folder in the Trash of your Mac, it does not actually erase. It remains on the hard disk.
To remove it irretrievably, it is necessary to use the command line of your Mac (Terminal). The technique is simple but risky, since it will be impossible to recover.
If, however, you want to use the Terminal, then follow this tutorial. We use the command rm (short for remove, delete, in French) and rmdir (dir for directory, folder) to delete one or more items.
Why delete files with the command line ?.
The deletion of the files via the Finder is not final because it is always possible to restore them. Sometimes, it is more convenient to go through the command line, here are the different cases :
Delete multiple files quickly and efficiently, and they will be unrecoverable.
Delete documents from the recycle Bin when you are experiencing persistent errors.
Delete hidden files in the Finder. They can contain settings for certain apps, and the Finder doesn’t display them.
If you have lost access to the Finder due to a dysfunction of your Mac.
Permanently delete files.
It is dangerously easy to delete files with the command rm. Here’s how to proceed :
Open the Terminal (Finder → Applications → Utilities).
Type cd ~/Desktop to the directory Office. (To type a tilde, press the alt keys to the left of the keyboard, and N.)
Attention : for each order, you will need to follow the spaces, uppercase, lowercase, and type the extension of your document (here, rtf).
To erase your file, enter the command, rm [filename].rtf
Once, the key Input button, the file will be permanently deleted, without you being able to recover it.
If you want to delete multiple items, type :
rm [filename].rtf [filename].rtf [filename].rtf.
Then, confirm by pressing Enter.
To prevent deleting files in a hurry, Apple has created a command, the command requires confirmation to delete each file.
To do this, you will need to type in -i before the name of your file : rm -i [filename].rtf.
To delete multiple documents, enter : rm -i [filename].rtf [filename].rtf [filename].rtf.
When you will press Enter, the command rm will not turn, -i will act as a pause button.
It will then be displayed remove Turo.rtf?. To confirm, type yes or Y.
Permanently delete empty folders.
Deleting files or directories is slightly different.
To run the command rm on a directory, you will need to enter cd ~/Desktop, type Enter, and then enter rmdir.
Note that this command is only used to delete only the empty directories.
In our example, we want to be rid of a directory named dossiervidewe type so rmdir dossiervide.
Be aware that you can’t use -i with the command rmdir, so it is very risky.
To delete directories full, read on.
Delete folders and sub-folders.
When you add -R or-r (for recursive) to your rm command, you instruct the Terminal to delete your folder but also all files and sub-folders that it contains. Remember that this deletion is permanent.
Type : rm -r [filename]
Delete one or more records locked.
If you are unable to empty the Trash on your Mac, a file is locked or you do not have permission to delete files, then you can use the command rm-R.
Enter rm-R, add a space, then drag and drop into the Terminal window, the(s) file(s) found in the Trash.
You will see displayed the files with a path such as : /Users/[lenomdevotremac]/.Trash/[filename].[extensiondufichier]
When you’re ready, all that remains is for you to press Enter.