---
url: >-
  /statelake/scripting-reference/functions-and-procedures/file-functions/windows-file-functions.md
---

# Windows File Functions

**Statelake** provides functions for working with files, both as **File Functions** and also as properties and methods for the **File Connection object class**, found at [File Connection Class (FileCon)](/statelake/scripting-reference/classes/file-connection-class-tflofilecon/).

Beyond that, you can use **Statelake** to activate the Windows "**FileSystemObject**", as a COM object, to access the functionality that it provides.

The following example shows how to use **Statelake** to interact with the Windows “**FileSystemObject**”.

Full information is available from Microsoft and other pages on the Internet.

```pascal
procedure OnMapEvent(var Value:Variant);
var
  fso: Variant; // COM objects are declared as type Variant
  vFileName: string;
begin
  fso := CreateOLEObject( 'Scripting.FileSystemObject' );
  vFileName := 'C:\Temp\ToBeDeleted.txt';
 if fso.FileExists( vFileName ) then
    fso.DeleteFile( vFileName )
 else
    LogInfo('File "' + vFileName + '" was not found.');
end;
```
