-
June 6th, 2011, 08:15 AM
#1
Performing tasks only if files exist in a directory
I am trying to perform several tasks on each file that exists in a specified folder, including creating a csv file using Monarch. This works fine whenever files exist in the folder, however if no files are present, the batch opens Monarch and 'freezes' because no files have been opened to apply the model to and subsequently create the csv output. Can someone please help me with the code to skip the Monarching steps if there are no files present. Here is my code:
SET MODELS=\\geisinger.edu\dfs\0004\0010\10006\TEST\JOBS\RCCALL01_CALL_PILOT\MODELS
SET OUTPUT=\\geisinger.edu\dfs\0004\0010\10006\TEST\JOBS\RCCALL01_CALL_PILOT\OUTPUT
SET HYPPROD=\\hypprod\RCDATA\TEST_IN\RCCALL01
SETlocal EnableDelayedExpansion
(set reports1=)
for %%i in ("%TARGET%\*.pdf") do (set reports1=!reports1! /rpt:%%i)
START /d "C:\Program Files\Monarch\Program\" Monarch.exe /mod:%MODELS%\CPMODEL1.xmod %reports1% /pxall /exp:"%OUTPUT%\CallPilot_%YESTERFILE%.csv"
@PING 127.0.0.1 -n 20 -w 3000 > nul
@PING 127.0.0.1 -n %1% -w 3000 > nul
ENDLOCAL
ECHO Y | DEL %TARGET%\*.*
ftp -i -s:"%~f0"&GOTO:EOF
open hypprod
rcuser
rcdata01
cd TEST_IN/RCCALL01
put \\geisinger.edu\dfs\0004\0010\10006\TEST\JOBS\RCCALL01_CALL_PILOT\OUTPUT\CallPilot_*.csv
bye
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|