Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Powershell to copy specific folders

$
0
0

With powershell, does a method exist in which I can compare the names of two folders and if a portion of the name matches, copy one to the other?

For example, I have two folders 'C:\Working' and 'C:\Production'.  In 'C:\Production' there are a multitude of folders with different names i.e. 'C:\Production\H023C994' and 'C:\Production\H023C995', etc.  Under 'C:\Working' there are a multitude of folders that correspond to these that are in this format 'C:\Working\H023C994-001' and 'C:\Working\H023C995-001'.

I need to look at the name in 'C:\Working' compare it to 'C:\Production' and if they match (the 'H023C994' part) copy the file from Working to Production.  Right now I have a person doing this and it's projected to take close a month to go through these thousands of folders.  Is there a ps command that can speed this up?


Viewing all articles
Browse latest Browse all 6937

Trending Articles