Answer» This batch job (below) sits on a server that calls a server in a REMOTE location. The remote server then calls a server in a different remote location. I am trying to move images using a single batch file. All of the servers have permissions on each other.
My job bombs out on the: for %%f in (%STORENEW%) do CALL :PULLIMAGES %%f%
any help is greatly appreciated thanks, Jlav
REM * VARIABLES SET STORENEW=\\store0%\abolder\bfolder\cfolder\*.jpeg SET HQPULLED=\\hqserver\e\data\ SET STOREPULLED=\\store0%\Pulled\ SET ERRORLOG=pullImages.err
REM ********************************************** REM * CHECK FOR STORE NUMBER PASSED AS PARAM TO BATCH JOB. REM ********************************************** if "%1"=="" GOTO NOSTOREERROR
REM ********************************************** REM * FOR EACH FILE IN NEW DIRECTORY AT STORE, PULL. REM ********************************************** ECHO %%f for %%f in (%STORENEW%) do CALL :PULLIMAGES %%f% GOTO END
REM ********************************************** REM * PULLIMAGES - Copy images to HQ, move to pulled REM * dir at store. REM ********************************************** :PULLIMAGES ECHO PULLING %1 TO HQ COPY %1 %HQPULLED% IF "%ERRORLEVEL%"=="1" GOTO PULLINGERROR ECHO MOVING TO PULLED DIR AT STORE MOVE %1 %STOREPULLED% IF "%ERRORLEVEL%"=="0" GOTO MOVINGERROR
GOTO END
REM ********************************************** REM * NOSTOREERROR - Error if no stores is passed to batch job. REM ********************************************** :NOSTOREERROR ECHO PLEASE PASS A STORE NUMBER TO PULL NOF IMAGES FROM. >> %ERRORLOG% EXIT /B
REM ********************************************** REM * PULLINGERROR - Error if pulling file to HQ. REM ********************************************** :PULLINGERROR ECHO ERROR PULLING FILE %1 TO %HQPULLED%. FILE SKIPPED. >> %ERRORLOG% EXIT /B
REM ********************************************** REM * MOVINGERROR - Error if moving file from new to pulled dir at store. REM ********************************************** :MOVINGERROR ECHO ERROR MOVING FILE %1 TO %STOREPULLED% DIR AT STORE. >> %ERRORLOG% EXIT /B
:ENDRemove the : in "CALL :PULLIMAGES", and REPLACE CALL with GOTODilbert, thank you for your response. I FOLLOWED your ADVISE and changed that line of code to
for %%f in (%STORENEW%) do GOTO PULLIMAGES %%f%
but it is still not copying or moving the files. Am I missing something else? Again, thanks for your help. This is my first forray into batch files. jlav Remove the %%f% from the same line.
|