News:

Facebook killed the radio star. And by radio star, I mean the premise of distributed forums around the internet. And that got got by Instagram/SnapChat. And that got got by TikTok. Where the fuck is the internet we once knew?

Main Menu

Simple Win PoSH script

Started by Joe, April 03, 2008, 12:57:37 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Joe

I'm looking for a script for Windows Powershell that can recursively delete empty folders. I recently removed a bunch of MP3s from a podcast that had been sorted into different artist folders, but I'm too lazy to delete the folders myself.

Thanks for anyone who can do this for me. ^_^
Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


iago

On Linux, I do:
rmdir *
or
rmdir */*
rmdir */*/*
etc.

Until I get deep enough. Does that work on Windows?

MyndFyre

Quote from: iago on April 03, 2008, 09:28:17 AM
On Linux, I do:
rmdir *
or
rmdir */*
rmdir */*/*
etc.

Until I get deep enough. Does that work on Windows?

Nah, rd doesn't recursively remove.

I don't know why they removed deltree from Vista. :(

C'mon Joe, whip up a PowerShell script yourself!
Quote from: Joe on January 23, 2011, 11:47:54 PM
I have a programming folder, and I have nothing of value there

Running with Code has a new home!

Quote from: Rule on May 26, 2009, 02:02:12 PMOur species really annoys me.

iago

"rmdir" only removes empty folders, which is why it works for me. Does Windows have a function that only removes empty folders?

(it'll be a funny day when I'm on a system where somebody aliases "rm -r" to "rmdir" :) )

Skywing

rmdir (alias rd) in cmd will only remove empty directories, unless you use /s.

Explicit

Might want to add /q (quiet) in there so it won't prompt you, not that it's necessary.
QuoteLike all things in life, pumping is just a primitive, degenerate form of bending.

QuoteHey, I don't tell you how to tell me what to do, so don't tell me how to do what you tell me to do! ... Bender knows when to use finesse.

[13:41:45]<@Fapiko> Why is TehUser asking for wang pictures?
[13:42:03]<@TehUser> I wasn't asking for wang pictures, I was looking at them.
[13:47:40]<@TehUser> Mine's fairly short.