I have a path where there are many directories with files and files outside the directory.
I want to extract all files/directories maintaining the folder structure.
Please help if possible. Thank you in advance.
Command used :
$Path = "Some path"
$Binaries = Get-ChildItem -Directory -File -Path $Path -Recurse
Write-Host $Binaries
Output : empty
If I understood your last comment correctly you are aiming to create one zip archive of an folder and its full content via powershell command. I would download 7zip and use the following command for convenience:
Compress-Archive -Path c:\msi -DestinationPath c:\logs\test.zip -CompressionLevel Optimal