Assume, you have next structure inside current folder
f0
|-f1
| |-a.txt
|-f2
|-b.txt
If than you execute next command inside this folder:
powershell -Command "Get-ChildItem -Path 'f0\*' -Recurse | Move-Item -Destination '.'"
files a.txt and b.txt will be copied, but without parent folders f1 and f2.
But, if you add any file into f0 folder
f0
|-f1
| |-a.txt
|-f2
| |-b.txt
|-fake.txt
The same powershell command will fork as expected
f0
f1
|-a.txt
f2
|-b.txt
fake.txt
Am I missing something?
Thanks.
Update
Initial task is to deploy cmake in automatic way. This is source script:
echo Downloading https://github.com/Kitware/CMake/releases/download/v3.15.3/cmake-3.15.3-win64-x64.zip
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://github.com/Kitware/CMake/releases/download/v3.15.3/cmake-3.15.3-win64-x64.zip', 'cmake-3.15.3-win64-x64.zip')"
powershell -Command "Expand-Archive -LiteralPath cmake-3.15.3-win64-x64.zip -DestinationPath ."
powershell -Command "Get-ChildItem -Path 'cmake-3.15.3-win64-x64\*' -Recurse | Move-Item -Destination '.'"
powershell -Command "Remove-Item 'cmake-3.15.3-win64-x64'"
powershell -Command "Remove-Item 'cmake-3.15.3-win64-x64.zip'"