I have a directory structure that looks like this :
- Root
- Older
I want to parse all folders in root and move them the Older subfolder.
How can I do this?
You can use get-childitem (gci) to get all childitems of the root-folder ($root), and move them (move-item) to the new destination. You just have to make sure, you will not move the destination itself, therefore we check that.
$root = "C:\temp\root"
$destination = "older"
gci $root | ? {$_.name -ne $destination} | move-item -Destination "C:\temp\root\$destination" -force