Anda berbicara Bahasa Indonesia? Baca artikel terjemahannya di sini!
Sometimes, on macOS, if a folder contains too much files, deleting it from the Trash might take a long time, or even possibly fail. I experienced it once with a very large project containing millions of files. Besides, deleting from the Terminal is faster… I think.
For this, we’re going to use the
rm -r command. It’s a UNIX command with the following structure:
rmis the command to remove files.
-ris the option for recursive removal. This is required if you want to delete a directory / folder, and this will remove the folder, along with its contents and subdirectories.
Empty Trash via Terminal
- Open Trash using Finder.
- Open Terminal.
rm -r, then a space. Let it be, don’t press enter!
- Drag the folder you want to permanently delete from the Trash into the Terminal window. You can also permanently delete multiple folders by dragging more than one either simultaneously, or after one another.
- Press Enter. Your file(s) should then disappear from the Trash, and permanently deleted!
Bonus: Delete File Directly via Terminal
Aside from going to Trash, you can also permanently delete files directly from Terminal. However, please keep in mind that this action is potentially dangerous, since it’s not going through Trash, which means that this action is irreversible. You can also potentially break the system if you accidentally delete files that are vital to your OS. Please use this wisely!
- Open Terminal.
rm -rthen hit space, then type the location and filename of the file that you want to delete. For example,
/Users/myusername/file-to-delete.txt. You can also drag file(s) from Finder to input it directly.
- Press Enter. If you have enough permission to delete it, it will be deleted immediately. If you don’t, an error will appear to prevent you from deleting files that are not yours.
Well, I guess that’s all for now, Folks. Hopefully this little tip can be useful when you’re trying to attempting a very large folder containing a large number of files. If you have any questions or additional tip, as usual, sound them off in the comments below. Finally, thanks for reading and see you in the next article 😁!