title: Batch File script to remove file that was duplicated in the Folder
body: <p>Been googling on how to remove file using filename and i haven't found any that will have same scenario as mine. I was really new with this batch file scripting.</p>
  
  <p>Problem:
  I have 1 folder file that have lots of files and most files have duplicate of 4 to 5 other files. The only distinct between this files are the timestamp which is included in the file name.</p>
  
  <pre><code>sssss_1020102_201412101123
  sssss_1020102_201412101124
  sssss_1020102_201412101125
  sssss_1020102_201412101126
  </code></pre>
  
  <p>I want to transfer all duplicate to other folder, and have the first file sssss_1020102_201412101123 remain in my folder.</p>
  
  <pre><code>for /r %%f in (*) do (
  set filename=%%~nxf
  set rootname=!filename:~0,13!
   IF "!rootname!"==""  (
       move "%source_folder%%filename%" %otherfolder% 
  ) ELSE ( %temp%=!filename:~0,13!
           )
  </code></pre>
  
  <p>)</p>
  
  <p>I'm trying to get the first few character of the filename and assigned it to a variable but still doesn't work.</p>
  
  <p>Thanks for the help.</p>