I have a folder structure where in Folder1 there's subdirectories where each contains a subdirectory of the same name again. From that directory I want to move all subdirectories into Folder0. There's subdirectories of the same name, so their content shall be moved to the according subdirectory in Folder0.
For example:
Folder1/Fotos Teil 1 von 178/Fotos Teil 1 von 178/Photos/* shall be moved to Folder0/Photos/*
This is the structure
Folder0
├─Photos
├─Memories
├─Albums and Favorites
│
Folder1
├─Fotos Teil 1 von 178
│ └─Fotos Teil 1 von 178
│ ├─Photos
│ ├─Memories
│ └─Albums and Favorites
│
├─Fotos Teil 2 von 178
│ └─Fotos Teil 2 von 178
│ ├─Photos
│ ├─Memories
│ └─Albums and Favorites
╎
.
.
.
╎
├─Fotos Teil 178 von 178
│ └─Fotos Teil 178 von 178
│ ├─Photos
│ └─Albums and Favorites
I understand that this is probably a job for PowerShell. I have only worked with bash scripts, but this needs to be done in Windows.
photosdirs moved to the top levelphotosdir? and the same to be done for the other dirs at the deeper level?Get-ChildItemto load a directory info object, you can use the.Parentproperty to find the parent dir. you can do.Parent.Parentto get the two parent dirs ... and then compare them. if they are the same, you have one of your double-named dirs. ///// however, a simpler way may be to just grab any dir with the desired name that is NOT at the top level.