Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Scripting the creation of subfolders IF a condition exists

Avatar of Hallidays
Hallidays asked on
Windows OSPowershell
7 Comments1 Solution89 ViewsLast Modified:
Hi all, i know this has been asked a lot but i cannot find anything for my specific scenario. I have a Windows file share with 1,691 folders, these folders contain numerous subfolders. What i want is to scan each top folder and check for subfolders named A, B and C, if these exist, i then want to go into each of them and create a folder called NEW. What i should end up with is

Folder1 > A > 2018
Folder1 > B > 2018
Folder1 > C > 2018

Folder1 may also contain subfolders D, E and F but i don't want anything to happen to these. Also, Folder1 may only contain subfolder B, if that is the case I do want the 2018 folder to be created.

As i said, i have 1691 folders to scan and they could each contain 3 folders that i need to create a subfolder for so all in all a possible 5073 folder creations. I'd rather not do this manually.