existdir - UDM Command

Syntax

existdir logical-name=directory

Description

The existdir command verifies that the specified directory exists and reports the results to the user. It also sets a variable, _existdir, with the results.

There is no default directory.

The command is valid only for the HFS file system, which is the file system for UNIX, Windows, and z/OS (HFS only).


IBM i

HFS supports the root and QOpenSys file systems under IFS.

z/OS

HFS supports the UNIX System Services file system.

Parameters

Parameter

Description

logical-name

Logical name of the transfer server to execute the existdir command.

directory

Name of the directory to check. This can be a relative path.

Examples

The following examples assume that the logical name remotesys is valid.


To check the /home/max/tmp directory:


existdir remotesys=/home/max/tmp

if $(_lastrc) EQ 0
 echo "The command ran correctly."
else
 echo "Check for error or warning messages."
end

echo ""

if <"$(_existdir)" EQ "yes">
 echo "The directory exists." 
end

if <"$(_existdir)" EQ "no">
 echo "The directory does not exist."
end

if <"$(_existdir)" EQ "error">
 echo "A file or system error occurred."
end

if <"$(_existdir)" EQ "">
 echo "A command error occurred."
end

Windows

The example would be:


existdir remotesys=C:\home\max\tmp ...


To check the directory /home/max/tmp/abc using a relative path, assuming that the current directory is /home/max/ and that /home/max/tmp/abc exists.


existdir remotesys=tmp/abc

if $(_lastrc) EQ 0
 echo "The command ran correctly."
else
 echo "Check for error or warning messages."
end

echo ""

if <"$(_existdir)" EQ "yes">
 echo "The directory exists." 
end

if <"$(_existdir)" EQ "no">
 echo "The directory does not exist."
end

if <"$(_existdir)" EQ "error">
 echo "A file or system error occurred."
end

if <"$(_existdir)" EQ "">
 echo "A command error occurred."
end

Windows

The example would be:


existdir remotesys=tmp\abc
...