So, I have a directory structure like this:
parent/
└── sub1
| └── sub1.1
| | └── source
| | └── something1
| | └── something2
| |
| └── sub1.2
| └── source
| └── something3
| └── something4
└── sub2
└── sub2.1
| └── source
| └── something5
| └── something6
|
└── sub2.2
| └── source
| └── something7
| └── something8
|
└── sub2.3
└── source
└── something9
└── something10
I want to move all files (with different filename) from all directories named source to its relative upper/parent directory. So, the result should be something like this:
parent/
└── sub1
| └── sub1.1
| | └── something1
| | └── something2
| |
| └── sub1.2
| └── something3
| └── something4
└── sub2
└── sub2.1
| └── something5
| └── something6
|
└── sub2.2
| └── something7
| └── something8
|
└── sub2.3
└── something9
└── something10
There is a linux example but i am after a batch version.
EDIT: Thanks, that should work. I originally had the below but it will only do one subfolder deep.
@echo off
for /D %%I in ("%~dp0*") do (
if exist "%%I\source\*" (
move /Y "%%I\source\*" "%%I\" 2>nul
rd "%%I\source" 2>nul
)
)