Just another newbie and possibly simple problem.
I got asked to write a batch program to copy one file (Filea) from one location to multiple folders.
I got the list of directories the fileA is supposed to go to and created following inside file called 'mycopy.bat'
rem @echo off
dir /B "C:\symmetrix" >"%temp%\symmList.txt"
For /F "tokens=* delims=" %%i in (%symmList%) do (set pathL=C:\Symmetrix\%%i\daily
copy /V %origPath% %pathL%
I got the idea that the problem lies in the assignment of the %pathL% variable.
When the program executes it either produces this:
copy /V H:\tests\GetNewFilesOnly.bat
The file cannot be copied onto itself.
0 file(s) copied.
copy /V H:\tests\GetNewFilesOnly.bat C:\Symm\000287700326\daily
1 file(s) copied.
Where 000287700326 is the last line in the symmList.txt
Hence, files never go to other folders even though pathL variable changes with every iteration and should point to the right location.
I've tried clearing pathL after each iteration by adding set pathL= after copy, but it seemes that interpreter jumps first to that line and then to copy command.
For various reasons I can't use third party apps and am stuck with batch files (no Perl, no VBS).
Any suggestions about what am I missing??