Skip to main content
  • Place orders quickly and easily
  • View orders and track your shipping status
  • Create and access a list of your products
  • Manage your Dell EMC sites, products, and product-level contacts using Company Administration.
Some article numbers may have changed. If this isn't what you're looking for, try searching all articles. Search articles

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 may have been automatically translated. If you have any feedback regarding its quality, please let us know using the form at the bottom of this page.

Article Content


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.

 


 

Article Properties


Affected Product

Software

Last Published Date

20 Apr 2021

Version

4

Article Type

Solution