Batch script to delete subfolder from multiple subfolders

Solved/Closed
JWillock Posts 2 Registration date Sunday October 8, 2017 Status Member Last seen October 8, 2017 - Updated on Nov 11, 2018 at 03:56 PM
filipo3 Posts 5 Registration date Saturday May 20, 2017 Status Member Last seen December 24, 2023 - 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

1 response

Blocked Profile
Oct 8, 2017 at 03:28 PM
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://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-xp/bb490909(v=technet.10)?redirectedfrom=MSDN

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!
3
JWillock Posts 2 Registration date Sunday October 8, 2017 Status Member Last seen October 8, 2017
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
0
Blocked Profile
Oct 8, 2017 at 06:42 PM
I encourage you to learn, and not cut and paste!
0
filipo3 Posts 5 Registration date Saturday May 20, 2017 Status Member Last seen December 24, 2023
Nov 16, 2017 at 10:23 PM
Thank you!
0