I have a lot of pictures that are in separate folders, but each folder is also within a folder. It looks like this
<path>\(nameoffolder)\full\
And I want to move all the images in the folder called full
to its parent folder (nameoffolder)
.
The (nameoffolder)
isn't a continuous number or anything but varies greatly in its name.
Is there a way to do this in batch, preferably with command line?
Use this batch file for this simple task after replacing C:\Temp
by path of root directory:
@echo off
rem For each subdirectory in the specified directory check if there is
rem a subdirectory with name "full" containing one or more files. If
rem this condition is true, move the files from subdirectory "full"
rem to its parent directory and then delete the subdirectory "full".
for /D %%I in ("C:\Temp\*") do (
if exist "%%I\full\*" (
echo Moving files to %%I ...
move /Y "%%I\full\*" "%%I" >nul
rd "%%I\full"
)
)
To understand the commands used and how they work, open a command prompt window, execute there the following commands, and read the displayed help pages for each command, entirely and carefully.
echo /?
for /?
if /?
move /?
rem /?
rd /?