Report

Batch Script To Delete Subfolder From Multiple Subfolders [Solved]

Ask a question JWillock 2Posts Sunday October 8, 2017Registration date October 8, 2017 Last seen - Last answered on Oct 8, 2017 at 06:42 PM by ac3mark
Hi There! Total beginner here...

I'm hoping to get a batch script to delete a specific subfolder from multiple subfolders in a specific folder. For example: I have a folder in my C Drive named "Test Folder". In that folder, I have 4 subfolders with the titles "Bill" "Sue" "Bob" "Joe". In each of those 4 folders, I have 3 subfolders titled "Test 1" "Test 2" "Test 3". I want to run a batch script to delete the subfolder "Test 2" from each of the 4 subfolders "Bill" "Sue" "Bob" "Joe".

Ultimately, in production, there will be 1000+ subfolders in the "Test Folder" folder, so this is why I'm looking for a script to assist with this.

I'm currently using Windows 10.

Can anyone help?

Thanks so much!

Jenny
Helpful
+1
plus moins
Ok, is this an attempt at manual labor right now, or is this a test of lesson for school? If it is work, related, as an IT person, if I were to program a task such as this, then I will do it for your boss, not you. If this is school, then you need to do your own work.

Either way, really, you need to do your own work.

"Why do you answer me like this, Mark?"

Here is why I shy aware from this type of solution offering: Because the scope is RARELY described 100% of what is needed, and if not deployed right, or understood, you delete every file that you have access to, and blame us for our solution.

There are plenty of resources out there that will describe file accessing and subfolders on MS site. Here is a good start:
https://technet.microsoft.com/en-us/library/bb490909.aspx

HEre is a start, it is the FOR command. This will start you on LOOPING through folders. After you verify you find the files you want to delete, go ahead and venture further into the other BATCH commands!

HAVE FUN!
JWillock 2Posts Sunday October 8, 2017Registration date October 8, 2017 Last seen - Oct 8, 2017 at 03:39 PM
@ ac3mark

Thank you for your response. I have actually already received support with this inquiry in another forum (on another site), so I will be marking this as "solved".

I can understand your hesitation and I appreciate you linking me with the technet.microsoft library. I will definitely review it as it seems like it will be a valuable resource.

Thanks again,

Jenny
Reply
ac3mark 7998Posts Monday June 3, 2013Registration date ModeratorStatus October 17, 2017 Last seen - Oct 8, 2017 at 06:42 PM
I encourage you to learn, and not cut and paste!
Reply
Leave a comment

Member requests are more likely to be responded to.

Members can monitor the statuses of their requests from their account pages.

A CCM membership gives you access to additional options.

Not a member yet?

Sign up now. It takes less than a minute and is completely free!