Windows XP Batch- IF EXIST FTP with Date Variable

前端 未结 1 792
青春惊慌失措
青春惊慌失措 2020-12-22 00:24

I am writing a quick batch to see if a file exists after executing an exe.

The file is created with a YYYYmmDDnumbernumbernumber.xml file name according to the curre

相关标签:
1条回答
  • you cannot check existence of file on ftp server with IF.Instead try this after replacing the parameters that starts with 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 IS OUT THERE && goto :skip_file_is_not_there
    echo FILE IS NOT THERE
    :skip_file_is_not_there
    del local.file /q >nul
    
    0 讨论(0)
提交回复
热议问题