Reputation: 81
Reading from a text that looks like this:
10888982_I
90889156_I 8 2014-04-25 07:10:00
10877565_I 17 2014-04-25 07:10:00
I am searching for content using the first column, variable %%i is set as the first column. If not found it echo's to another text file. It currently echos only the first column, how can I make it echo the entire line? This is the script I am currently using
for /f "tokens=1" %%i in (%src_folder%\spots.txt) DO (
if EXIST %src_folder_hd%\%%i.mpg (
xcopy "%src_folder_hd%\%%i.mpg" "%dest_folder%" /Y
) else (
echo=%%i >> %src_folder%\missing.txt
)
))
Upvotes: 2
Views: 584
Reputation: 130819
for /f "delims=" %%A in (%src_folder%\spots.txt) do for /f %%B in ("%%A") do (
if exist "%src_folder%\%%B" (
xcopy "%src_folder%\%%B" "%dest_folder%" /y
) else echo %%A>>"%src_folder%\missing.txt"
)
Note that the code assumes the file name never contains spaces.
Upvotes: 2
Reputation: 82247
You set the option tokens=1
so you only want the first token.
Change it to tokens=*
or delims=
, both will work for you
Upvotes: 0