Login Scripts
Checking for Existence of a File or Directory

A useful technique is to check for the existence of a file or directory. You can then set actions on the result. This could be copying an update across, running an another application or just recording that something is installed. This can be achieved using the built in command line tools, as per the same script below.

In both examples the script will move on to the ":next" if the file or directory is found. You could change the "if exist" to "if not exist" if you want the script to react to something being missing as an alternative.

Checking for a file

In this example, the script is checking for a file called "content.txt" in the directory "example".

Checking for a Directory

This sample is checking for a directory called "content" which is a sub directory of "example"


Top of the Page - Home Page
Last Page Update: 08/03/2012

Copyright Sembee Ltd. 1998 - 2015.

Reproduction of any content on this web site is prohibited without express written consent. Use of this web site is subject to our terms and conditions.

All trademarks and registered trademarks are property of their respective owners. This site is not endorsed or recommended by any company or organisation mentioned within and is to provide guidance only and as such we cannot be held responsible for any consequences of following the advice given.

Sembee Ltd. is registered in England and Wales at 1 Carnegie Road, Newbury, Berkshire, RG14 5DJ.
Registered company number: 4704428. VAT Number GB 904 5603 43.

Server 2