Zend certified PHP/Magento developer

Batch move files & folders including structure with combine

Wrote a batch file that was supposed to move folder & file structure from one parent directory to the other on each drive while also combining any existing folders only to find out the MOVE command isnt able to combine. Cannot use Xcopy or Robocopy because they copy the source to the destination and then delete the source. Files/folders being moved are very large, so looking for a solution that will move instead of copy/delete… Code I have written so far is below. Currently it will move the files/folders that don’t need to be combined and then use robocopy to do the rest, but its still taking over 24 hours where a manual CTRL+X and CTRL+V for each drive is instant… Anyone able to help?

@echo off
REM Last Edited 12/19/21 2:48PM
REM Enter Old Camera Name, New Camera Name
setlocal enableDelayedExpansion
set OldCamName=%~1
set NewCamName=%~2

REM Determine Camera Physical ID from Camera Name


for /F "skip=1" %%F in ('wmic LogicalDisk WHERE DriveType^=3 GET DeviceID') do (
    echo Moving Low Quality on drive %%F%...    
    set oldDirectory="%%F%DW Spectrum Medialow_quality!OldCamName!"
    set newDirectory=%%F%DW Spectrum Medialow_quality!NewCamName!
    FOR /d %%i IN (!oldDirectory!*) DO (
        move /Y "%%i" "!newDirectory!"
        robocopy "%%i" "!newDirectory!%%~ni" /E /J /MOVE /NJH /NJS
    )
    echo Moving High Quality on drive %%F%...
    set oldDirectory="%%F%DW Spectrum Mediahi_quality!OldCamName!"
    set newDirectory=%%F%DW Spectrum Mediahi_quality!NewCamName!
    FOR /d %%i IN (!oldDirectory!*) DO (
        move /Y "%%i" "!newDirectory!"
        robocopy "%%i" "!newDirectory!%%~ni" /E /J /MOVE /NJH /NJS
    )
)