I have a weird problem, looking for the Powershell solution, but haven’t figured out the syntax yet…
I have a directory full of almost 40k folders. It used to be only 20k, but due to a new folder naming convention from an attached application, each folder got duplicated with a new name. They look like this:
C:\Directory\Subfolder1
C:\Directory\Subfolder1 {dd-12345}
NOTE - Subfolder1 {dd-12345} has a random assortment of numbers and letters, but will always be appended with “{dd-”, and always closes with “}”
Subfolder1 has contents in it that I need to migrate to Subfolder1 {dd-12345}. Essentially I want my script to do this:
- Get-Childitem ‘C:\Temp\SourceFolders*’ -Recurse
- For each folder, match the folder with a similar name and move the contents from the source folder (Subfolder1) to destination folder (Subfolder1 {dd-12345}).
- This is the piece I can’t figure out the logic for…struggling trying to use a match function with a foreach statement.
- Remove-Item 'C:\Temp\SourceFolders\Subfolder1 -Recurse
Any help would be appreciated, thanks.