SOLVED Delete folders and all files within them

Joined
Feb 3, 2022
Messages
3
Reaction score
0
I need a script that will delete all the folders (and files within those folders).

I need to delete folders called "temp" and "Temp" from a folder and all it's child folders.

I'm using Windows PowerShell 5.1

please post a script and use the -WhatIf

I am not a technician or a programmer, so please list it as though you were speaking to a child.
 
Joined
Sep 26, 2017
Messages
3,453
Reaction score
616
I've studied on this some and all I come up with is one problem with such a script, namely many folders will have a desktop.ini file in them and as a system file will require admin confirmation for deleting, might be difficult adding that to a script.
 
Joined
Feb 3, 2022
Messages
3
Reaction score
0
I've studied on this some and all I come up with is one problem with such a script, namely many folders will have a desktop.ini file in them and as a system file will require admin confirmation for deleting, might be difficult adding that to a script.


I will research the issue some more using Google and c what I come up with

Thanks
 
Joined
Feb 3, 2022
Messages
3
Reaction score
0
Is there a cmdlet that I could use to find all .ini files within folders and subfolders so that I could use that cmdlet to delete them then just add that line of code first before writing the rest of the script?
 
Joined
Sep 26, 2017
Messages
3,453
Reaction score
616
A Search for desktop.ini or any other file can bring up a list of what is found but will include any/all folders the term is found in.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top