I have a logfile.txt that contains the following lines of text:
C:\VIDEO\My Video 1\My Video 1.mkv
C:\VIDEO\MyVideo2\MyVideo2.mkv
C:\VIDEO\My.Video.3\My.Video.3.mkv
and a folder C:\Temp that contains the files:
My Video 1.mkv
MyVideo2.mkv
My.Video.3.mkv
I need to use the logfile.txt to match the respective filename.mkv that is listed in the logfile, then move the file to its correct folder (as shown in the logfile).
E.g., My Video 1.mkv should be moved to C:\VIDEO\My Video 1\
The relevant folders already exist within C:\VIDEO and so do not require creation.
How can I write a batch file for this?
I am starting off right now with something like this, but I am now stuck:
@echo off
setlocal enableDelayedExpansion
set "logfile=C:\Temp\logfile.txt"
set "SourcePath=C:\Temp"
set "DestPath=C:\VIDEO"
if exist ..\%DestPath%\nul rd /s /q ..\%DestPath%
if not exist ..\%DestPath%\nul md ..\%DestPath%
for /f "delims=: tokens=1*" %%A in ('findstr /n "^" "%logfile%"') do move "%SourcePath%\%%a" "%DestPath%"
Can someone please assist?