title: Batch file to copy text files from Sub directories then merge them together
body: <p>I am looking at trying to do a mass merge of txt files from different directories. </p>
  
  <p>So i have </p>
  
  <p>C:/data/Folder 1/Test.txt<br>
  c:/data/Folder 2/Test.txt<br>
  c:/data/folder2/testfolder/test.txt<br></p>
  
  <p>Now my problem is being able to move them all into one directory while renaming them, as unfortunately they all have the same name and then merge them together.</p>
  
  <p>From what i can work out so far, </p>
  
  <p>I can use the following to move them all to one directory</p>
  
  <pre><code>For /r c:/data %F in (*.txt) do copy %f C:/exporteddata 
  </code></pre>
  
  <p>which will take all the text files from the data directory and put them into the exporteddata directory but this only works if each file name is unique which in my case they are all the same name</p>
  
  <p>I know once i have all the .txt file in the same directory i can use the</p>
  
  <pre><code>copy *.txt output.txt 
  </code></pre>
  
  <p>running this from within the exported data directory</p>
  
  <p>But what i cant work out is how to put in a rename which will give all the txt files a unique ID before copying them.</p>
  
  <p>Any help would be great.</p>
  
  <p>Many Thanks</p>