Skip to content
-
Subscribe to our newsletter & never miss our best posts. Subscribe Now!
The Server Admin
The Server Admin
  • Home
  • Linux
  • Windows
  • About
  • What Powers The Server Admin
  • Home
  • Linux
  • Windows
  • About
  • What Powers The Server Admin
Close

Search

  • https://www.facebook.com/
  • https://twitter.com/
  • https://t.me/
  • https://www.instagram.com/
  • https://youtube.com/
Subscribe
Windows

Delete directory from command line

By Anthony
March 24, 2024 2 Min Read
0

Do you ever find yourself in the terminal and wanting to remove a bunch of files and folders or have a script that your writing and want it to prune the older copies? How do we do this? Turns out there is a command call rmdir that will do this in the shell.

***** BIG NOTE!! THIS COMMAND WILL BYPASS THE RECYCLE BIN AND PERMINENTLY DELETE

So you can see I am in the base folder call Backups, and inside that folder I created a folder called dude. I then ran the dir command to show that it was there, and then the magic command:

rmdir

So you can see that I did a rmdir dude which removed the directory called dude, and then I did a dir command to show that it was gone.

So what happens if the fodler is not empty? Well it will give an error and ask you want to do Example.

Ok super cool, great for human interactions but your writing a script or you know that it is ok to remove this folder so how do I bypass this I know what I am doing?? Cool, well lets do a powershell command for that now.

Remove-Item foldertodelete -Recurse -Force -Confirm:$false

So as you can see I had the same test directory as before, I showed the contents of the folder, then I ran that command, and poof it was all gone, no warning, no confirming, no nothing, its just gone.

This script / command is pretty much the same thing as the Linux version of rm -Rf /dir as this will kill itself very easily destorying a system if used wrong.

Author

Anthony

Follow Me
Other Articles
Previous

Show all Mount Points – Powershell

Next

Caddy Webserver – Install

No Comment! Be the first one.

Leave a Reply

You must be logged in to post a comment.

Search

Need a Virtual Server for sysctl testing? Check out our plans!

Popular Posts

  • Mount sFTP folder as local drive
    by Anthony
    June 9, 2026
  • Robocopy Examples
    by Anthony
    February 12, 2026
  • Rsync Command Examples
    by Anthony
    February 10, 2026

Trending

  • Mount sFTP folder as local drive
    by Anthony
    June 9, 2026
  • Adding a GUI to a Server or VPS
    by Anthony
    August 27, 2024
  • Back up to a shared folder with Time Machine on Mac
    by Anthony
    January 4, 2025
  • Backup Your Databases
    by Anthony
    March 24, 2024

Editors Picks

    Send an email:
    mail@example.com

    Call me:
    123-456-7890

    • Facebook
    • Twitter
    • Instagram
    • TikTok
    • LinkedIn
    • Behance
    Copyright 2026 — The Server Admin. All rights reserved. Blogsy WordPress Theme