I am trying to do some Logs backup and struggle with ps1 command which can do this for me.
I have folder structure like this:
folder_root/
├── sub_a/
│ ├── Logs
│ ├── bootstrap.min.css
│ ├── Configuration
├── sub_b/
│ ├── Logs
│ └── Settings
└── sub_c/
├── Logs
├── Application
├── class.js
└── other-file.html
And I need to extract only Logs folder from all subdirs and copy it into backup folder (which exists) respecting existing folder structure:
Backup-03-24/
├── sub_a/
│ └── Logs
├── sub_b/
│ └── Logs
└── sub_c/
└── Logs
How to achieve this using Powershell? I am trying to use Copy-Item cmdlet with wildcard in path, but it does not work.
Copy-Item -Destination "C:\folder_root\*\Logs"