Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Get-ChildItem $SourceFolder -Include $ExtArray -Recurse | forEach {
- ## Remove the original root folder
- $split = $_.Fullname -split '\'
- $DestFile = $split[1..($split.Length - 1)] -join ''
- ## Build the new destination file path
- $DestFile = "C:DestinationFolder$DestFile"
- ## Copy-Item won't create the folder structure so we have to
- ## create a blank file and then overwrite it
- $null = New-Item -Path $DestFile -Type File -Force
- Copy-Item -Path $_.FullName -Destination $DestFile -Force
- }
Add Comment
Please, Sign In to add comment