Windows XP Batch- IF EXIST FTP with Date Variable -


i writing quick batch see if file exists after executing exe.

the file created yyyymmddnumbernumbernumber.xml file name according current date.

how check file variable in beginning? here have far:

@echo off  set mydate=%date:~10,4%%date:~4,2%%date:~7,2%  if not exist "ftp://ftpsite/%mydate%*.xml" (echo nah) else (echo yea)  pause 

you cannot check existence of file on ftp server if.instead try after replacing parameters starts my_ :

!cls&echo off&setlocal enabledelayedexpansion !cls&goto :ftp_end open my_ftp_server user my_user pass my_pass cd my_remote_dir ls . local.file bye :ftp_end  ftp -s:%0 set mydate=%date:~10,4%%date:~4,2%%date:~7,2% type local.file | findstr  /b "%mydate%" | find ".xml" && echo file out there && goto :skip_file_is_not_there echo file not there :skip_file_is_not_there del local.file /q >nul 

Comments