Home / Software / Computer programming / .bat file bombing out - trying to move files acros
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] - (Bottom) Print
Author Topic: .bat file bombing out - trying to move files acros  (Read 2189 times)
jlav
Guest
« on: February 28, 2007, 01:40:49 PM »

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

:END
IP logged
Dilbert
Moderator
Egghead



Thanked: 40
Posts: 3,480

Welcome to ComputerHope!

« Reply #1 on: February 28, 2007, 05:42:23 PM »

Remove the : in "CALL :PULLIMAGES", and replace CALL with GOTO
« Last Edit: February 28, 2007, 05:42:41 PM by Timothy_Bennett » IP logged

"The geek shall inherit the Earth."
jlav
Guest
« Reply #2 on: March 01, 2007, 06:03:27 AM »

Dilbert, 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
IP logged
Dilbert
Moderator
Egghead



Thanked: 40
Posts: 3,480

Welcome to ComputerHope!

« Reply #3 on: March 01, 2007, 05:52:03 PM »

Remove the %%f% from the same line.
IP logged

"The geek shall inherit the Earth."
Pages: [1] - (Top) Print 
Home / Software / Computer programming / .bat file bombing out - trying to move files acros « previous next »
 


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright © 2010 Computer Hope ® All rights reserved.
Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Page created in 0.229 seconds with 20 queries.