Batch Script To Delete Subfolder From Multiple Subfolders [Solved]

JWillock 2 Posts Sunday October 8, 2017Registration date October 8, 2017 Last seen - Oct 8, 2017 at 09:42 AM - Latest reply: filipo3 4 Posts Saturday May 20, 2017Registration date November 16, 2017 Last seen
- Nov 16, 2017 at 10:23 PM
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
See more 

4 replies

Reply to this topic
ac3mark 8335 Posts Monday June 3, 2013Registration dateModeratorStatus December 12, 2017 Last seen - Oct 8, 2017 at 03:28 PM
+3
Helpful
3
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 2 Posts 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
ac3mark 8335 Posts Monday June 3, 2013Registration dateModeratorStatus December 12, 2017 Last seen - Oct 8, 2017 at 06:42 PM
I encourage you to learn, and not cut and paste!
filipo3 4 Posts Saturday May 20, 2017Registration date November 16, 2017 Last seen - Nov 16, 2017 at 10:23 PM
Thank you!
Respond to ac3mark