:: th-378655.bat [TxtFileList] [DestinationPath]
@echo off
REM Move files/folders specified in a newline-delimited txtfile list to the location of 'DestinationPath'.
set "default_list_path=C:\Users\%USERNAME%\Desktop\ListOfFilesToMove.txt"
set "default_destination_path=C:\Entries\in\ListOfFilesToMove.txt\will\be\moved\to\here"
set "overwrite=FALSE"
if not "%~3"=="" echo Error: unexpected arguments& exit /b
if not "%~2"=="" ( set "destination=%2" ) else ( set "destination="%DEFAULT_DESTINATION_PATH:"=%"" )
if not "%~1"=="" ( set "list=%1" ) else ( set "list=%DEFAULT_LIST_PATH%" )
if not exist "%LIST:"=%" echo Error: list could not be found& exit /b
if not exist "%DESTINATION:"=%" echo Error: the destination path could not be found& exit /b
set /a counter=0
for /f "delims=" %%I in ('type "%LIST:"=%"') do (
if exist "%%~fI" (
if exist "%DESTINATION:"=%\%%~nxI" (
if /i "%OVERWRITE%"=="TRUE" (
set /a counter+=1
move /y "%%~fI" "%DESTINATION:"=%" >NUL
) else (
echo The path "%DESTINATION:"=%\%%~nxI" already exists.
)
) else (
set /a counter+=1
move "%%~fI" "%DESTINATION:"=%" >NUL
)
) else (
echo No such item "%%~I".
)
)
echo.& echo %COUNTER% files or folders were moved.