FileExists

PLCopen motion icon

 Function Block - Tests if a file exists.

Inputs

Input

Data Type

See Data Types.

Range

Unit

Default

Description

Execute

BOOL

FALSE, TRUE

N/A

No default

On the rising edge, test to see if a file exists.

Path

STRING

No range

N/A

No default

The path to the file.

Outputs

Output

Data Type

See Data Types.

Range

Unit

Description

Done

BOOL

FALSE, TRUE

N/A

If TRUE, the command completed successfully.

Error

BOOL

FALSE, TRUE

N/A

If TRUE, an error has occurred.

ErrorID

DINT

Enumerated

N/A

Exists

BOOL

FALSE, TRUE

N/A

The existence of the file.

  • TRUE: Indicates the file exists
  • FALSE: Indicates the file does not exist.

FBD Language Example

Not available.

FFLD Language Example

Not available.

IL Language Example

Not available.

ST Language Example

(* FileExists example *)
CASE StepCounter OF
0:
  Inst_FileExists(TRUE, 'Test.txt');
  StepCounter := StepCounter + 1;
1:
  Inst_FileExists(TRUE, 'Test.txt');
  IF Inst_FileExists.Done THEN
     TestFileExists := Inst_FileExists.Exists;
     Inst_FileExists(FALSE, '');
     StepCounter := StepCounter + 1;
  END_IF;
END_CASE;

See Also