Remove a directory in the macOS or Linux terminal
How can you delete a folder on macOS or Linux with a terminal command?
Remove folder recursively, force
Remove folder and all contents (also subfolders) and never prompt.
rm -rf testfolder
Remove folder recursively
Remove folder and all contents (also subfolders). Command might prompt before removing.
rm -r testfolder
Remove empty folder
Remove folder if it is empty.
rm testfolder
Meaning of the parameters
parameter | description |
---|---|
r | Recursive |
f | Force |
Written by Loek van den Ouweland on October 19, 2020. Questions regarding this artice? You can send them to the address below.