Just specify the recurse parameter as suggested:
rm -r app
If the folder contains hidden or read-only files, add the -Force
parameter:
rm -r -fo app
This is the short form of:
Remove-Item -Recurse -Force -Path app
If you do not have proper access rights, then you can of course not delete it.
Background
rmdir
and rd
are commands (not executables) you can call on the command prompt. rm
is not available by default. All three terms may also point to executables if you have a MinGW environment installed, for example. But they will not be available in PowerShell, because PowerShell uses those words as aliases for the cmdlet Remove-Item
:
PS> 'rm', 'rmdir', 'rd' | Get-Command
CommandType Name Version Source
----------- ---- ------- ------
Alias rm -> Remove-Item
Alias rmdir -> Remove-Item
Alias rd -> Remove-Item
If you have some of the tools available as executables, you can still access them in PowerShell by specifying the full path to them, like:
PS> C:\path\to\MinGW\msys\1.0\bin\rm.exe
But let's stick to Remove-Item
. As it is a cmdlet, it expects certain parameters or switches, like -Recurse
. You can abbreviate them until to that point, they remain unambiguous compared to other possible parameters. Therefore you can use:
rm -r
which looks like in bash, for example, where you can also pass two parameters like this:
rm -rf
When you send this command to PowerShell, it will try to match -rf
to a parameter that begins with rf
, which does not exist. In PowerShell you have to pass each parameter individually to a cmdlet. To pass the -Force
parameter, you have to write at least -fo
, because there is also a parameter -Filter
and thus -f
would be ambiguous.
In conclusion, to get the equivalent of rm -rf
from bash in PowerShell, you have to write at least:
rm -r -fo