问题
Is it possible to copy all the files contained recursively from a specific folder and its subfolders directly to a only one flat directory without respecting anymore the source hierarchy folders?
回答1:
Of course that's possible. Why not?
Counter = 0
Get-ChildItem -Path <Path> -Filter * -Recurse -File |
Copy-Item -Destination <Destination Path> -PassThru |
Foreach-Object{
$counter++
Rename-Item -Path $_.FullName -NewName ($_.BaseName + '_' + ("{0:000}" -f $Counter) + $_.Extension)
}
来源:https://stackoverflow.com/questions/49852380/copy-files-recursively-from-a-hierarchy-to-a-single-flat-folder