I have a folder with many subfolders (subfolder1). Under each subfolder1 is another subfolder (subfolder2) containing files. I want to remove the first level of subfolder1 so that all I have is subfolder2 and subfolder2s contents.
So I guess it would work by moving subfolder2 plus contents to a new folder, thereby removing the subfolder1 from the folder structure.
There are 1000s of subfolder1s to be removed from this folder structure.
Any advice would be greatly appreciated.
Kind Regards, Martina
I haven’t been able to figure it out. Powershell beginner.
You could get all child items of each first level subfolder and move each one of this childs one level up and then delete the empty first level folder shells. Test on a test folder structure before using on your files:
$files = Get-ChildItem “c:\folder\base”
Get-ChildItem $files | Move-Item -Destination { $_.Directory.Parent.FullName }
$files | Remove-Item -Recurse