0

My employer asked me to manually copy some movies from a server (which I have .txt list of) to an external hard drive so that he can send them to another branch. But since there are hundreds of movie files in the list and the server, I was wondering if I could get or write a script which could copy them at once using my text file list? Any help would be really appreciated!

Note: I'm using Windows 10 on a PC connected to 2 Data Drive Servers The text file list has each movie name separated line by line

I have tried some code that I found in this link: Copy a list (txt) of files

@echo off
set src_folder=d:\source\
set dst_folder=d:\target\
set dir_list=d:\copylist.txt
if not exist "%dst_folder%" mkdir "%dst_folder%"
for /f "delims=" %%f in (%dir_list%) do (
    if not exist "%dst_folder%\%%f\" (
        mkdir "%dst_folder%\%%f\"
    )
    xcopy "%src_folder%\%%f\*.*" "%dst_folder%\%%f\"
)

It keeps saying that %%f was unexpected, instead of copying the movie folders based on the text list

Ken Y-N
  • 14,644
  • 21
  • 71
  • 114
Zidane
  • 21
  • 1
  • I've fixed the formatting, I hope... Were you trying to run the code all as one line, or was that just a copy-paste issue? – Ken Y-N Feb 06 '19 at 06:43
  • Possible duplicate of [What is the difference between % and %% in a cmd file?](https://stackoverflow.com/questions/14509652/what-is-the-difference-between-and-in-a-cmd-file) - are you trying to run from the command line? If so, you only need a single `%`, so `%f` not `%%f`. – Ken Y-N Feb 06 '19 at 06:52
  • @KenY-N Yes, I tried to run all the code in one line. And I'm using a .bat file with the code copied to it. – Zidane Feb 07 '19 at 06:30

0 Answers0