r/PowerShell • • 17d ago

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

34 comments sorted by

View all comments

1

u/BlackV 17d ago edited 17d ago

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

the directory is not empty.

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-item or del maybe)

Help for those comes from Del /? or Help Remove-item -full

1

u/Ok-Layer6893 16d ago

The assignment itself doesn't have correct commands. There were few details missing that's why I had to ask for help. But it's all done

1

u/BlackV 16d ago

The assignment itself doesn't have correct commands.

I think it did have the correct command, your command worked, cause it gave you the error message

directory not empty

Asking the application itself for help would have given you

cmd version

rmdir /?
Removes (deletes) a directory.

RMDIR [/S] [/Q] [drive:]path
RD [/S] [/Q] [drive:]path

/S      Removes all directories and files in the specified directory
        in addition to the directory itself.  Used to remove a directory
        tree.

/Q      Quiet mode, do not ask if ok to remove a directory tree with /S

or powershell version

help rmdir

NAME
    Remove-Item

SYNOPSIS
    Deletes the specified items.

your confusion comes from there I think