Skip to main content
  • Place orders quickly and easily
  • View orders and track your shipping status
  • Create and access a list of your products

Using a batch file to check for file existence of a file.

Summary: This article describes the steps for implementing batch files to check for file existence of a file.

This article applies to   This article does not apply to 

Symptoms

Use a batch file routine to check for the existence of a file.

You can run a batch file from the command to check for the existence of a file and then perform a routine when it arrives. 

NOTE: The sleep.exe program is required to be installed prior to running the batch file and is supplied with the Windows NT Resource Kit.
 

Cause

.

Resolution

Here is an example, perform the following steps to create a routine batch file.

  1. Click Start, and click Run.
  2. In the Open field, type CMD.
    A command prompt window appears.
  3. Type edit test.bat and press <Enter>.

    NOTE: The word test may be substituted with another word.
  4. Type :check_for_file_existence and press <Enter>.
  5. Type if exist c:\ftp\ftpfile.txt goto perform and press <Enter>.

    NOTE: The file ftpfile.txt may substituted with other files.
  6. Type sleep 200 and press <Enter>.

    NOTE: The number of seconds may be increaed or decreased from 200.
  7. Type goto check_for_file_existence and press <Enter>.
  8. Type :perform and press <Enter>.

NOTE: This routine checks for ftpfile.txt every 200 seconds. This type of routine is useful when you need to run a program once a file has been sent via FTP to your computer.

 


 

Affected Products

Software