r/PowerShell • u/Ok-Layer6893 • Sep 27 '26
Question Need help with homework π«
I'm very new to this. I'm asked to delete a directory and all of its files. D:\software\arch98
But when I do this:
PS C:\Users\Administrator\> rmdir D:\software\arch98
It says the directory is not empty.
I'd really appreciate.
0
Upvotes
10
u/PuerPalatinius Sep 27 '26
Remove-Item -Path "D:\software\arch98" -Recurse -Force
4
u/FLESHLEGO Sep 27 '26
Rmdir is not a powershell command. Remove-item is.
Whatever command you end up using, read up on the arguments it accepts. You need this to delete folders with contents.
GL
1
u/Ok-Layer6893 Sep 27 '26
Yeah I'll look up some more websites and tutorial videos. Thank you
1
u/Bassflow Sep 27 '26
Remove-item -path "D:\software\arch98" -Recurse
1
u/funkyloki Sep 27 '26
So, they didn't just throw this at you and say do this. They likely provided you with some kind of literature, digital or print, that you can use to figure out what it is you need to do.
Have you done all the assigned reading, have you completed all the supplemental work?
1
u/BlackV Sep 27 '26 edited Sep 27 '26
Based on the responses a guess they might have some restrictions on what commands can be run
What does
rmdir /?or&rmdir /?, tell you?The error message it telling you what the issue is
you need to do the relevant steps to to fix that, I'd suggest that's what the lesson is here they're trying to teach
What do the switches from the command above tell you that might empty that directory?
Or what other command could you run before hand to empty the directory? (
Remove-itemordelmaybe)Help for those comes from
Del /?orHelp Remove-item -full1
u/AroTesCra Oct 02 '26
In Powershell there is something called an alias.
Get-Alias to see them
My fav 2 are
% for for each-object
And
? For where-object
rmdir is alias for Remove-Item
You need rmdir p:\ath\here -recurse -force -confirm:$false
Iβm not sure about the confirm one sometimes I mix it up in my head lol and I am playing games right now so I am typing fast between rocket league matches.
0
u/Majestic_Rhubarb_ Sep 27 '26
In powershell/pwsh you can view the parameters a command takes.
Type βRemoveβ and press tab or ctrl+space and it will give you some help.
Once the command is chosen press β-β and then tab or space again for more help
0
u/pigers1986 Sep 27 '26
RMDIR is NOT POWERSHELL command.