Hi,
I am a newbie in batch scripting and would like to figure out how to check if any csv exists on "\\ftpserver\Dump\DEPARTMENT" location. if there are no csv files then the script
should exit without running any other command but if there are csv exists then move all the csv to "\\ftpserver\Dump\DEPARTMENT\run\" and execute the program should follow.
cd "\\ftpserver\Dump\DEPARTMENT"
REM move the files to the run folder "\\ftpserver\Dump\DEPARTMENT\run\"
move /Y "\\ftpserver\Dump\DEPARTMENT\*.csv" "\\ftpserver\Dump\DEPARTMENT\run\"
REM run the SCB Job
@ECHO off
"C:\Program Files\SCB\Workbench.exe" run-job -s test.scb.com -j 232
REM Move the files from the run to processed folder "\\ftpserver\Dump\DEPARTMENT\processed\"
move /Y "\\ftpserver\Dump\DEPARTMENT\run\*.csv" "\\ftpserver\Dump\DEPARTMENT\processed\"
Regards,
Vick
exit when no CSVs found
Moderator: DosItHelp
Re: exit when no CSVs found
It seems there is missing only the "csv-check" part:
For further information type "if /?" and "goto /?" (without doublequotes) into the command shell (cmd.exe).
penpen
Code: Select all
@echo off
if not exist *.csv goto :eof
:: insert your other code here
penpen