title: Use .txt logfile to move files into multiple folders
body: <p>I have a <code>logfile.txt</code> that contains the following lines of text:</p>
  
  <pre><code>C:\VIDEO\My Video 1\My Video 1.mkv
  C:\VIDEO\MyVideo2\MyVideo2.mkv
  C:\VIDEO\My.Video.3\My.Video.3.mkv
  </code></pre>
  
  <p>and a folder C:\Temp that contains the files:</p>
  
  <pre><code>My Video 1.mkv
  MyVideo2.mkv
  My.Video.3.mkv
  </code></pre>
  
  <p>I need to use the <code>logfile.txt</code> to match the respective filename.mkv that is listed in the logfile, then move the file back to its correct folder (as shown in the logfile).</p>
  
  <p>e.g  <code>My Video 1.mkv</code> should be moved to <code>C:\VIDEO\My Video 1\</code></p>
  
  <p>The relevant folders already exist within <code>C:\VIDEO</code> so do not require creation.</p>
  
  <p>How can I write a batch file for this?</p>
  
  <p>I am starting off right now with something like this, but I am now stuck:</p>
  
  <pre><code>@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%"
  </code></pre>
  
  <p>Can someone please assist?</p>