Tyl has an extensive set of system functions that cover all file system management activities. In order to work with the file system you do not need to define any file objects, but simply give the appropriate file or directory path to the function being called.

First, let's create a directory 'dir' on the file system root directory:
fsrd string.section io.cwd 0 1
dirpath fsrd + ':/dir/'
io.write dirpath
io.exists dirpath ? print 'directory `' + dirpath + '` created successfully'
directory 'C:/dir/' created successfully
io.cwd is a system variable that holds the current directory in which the program resides, and its first character will be the file system root letter. So if the root letter is 'C', dirpath value should be 'C:/dir/'.

Note that the directory path dirpath value is ending with a forward slash character. This is mandatory for the system to identify the path as a directory path. So for all directory functionalities, it is needed to provide a path that ends with forward or backward slash.

io.write is a system function that works with directory or file path. If it is a directory path, the system will create the directory, as well as all directories in the directory path, provided that the directory does not exists. If the path does not end with a slash, a file will be created, provided that the directory of the file path exists.

To check whether a file or directory exists, call io.exists with their path.

To create a file 'file.ext':
path 'C:/dir/file.ext'
io.write path
io.exists path ? print 'file `' + path + '` created successfully'
file 'C:/dir/file.ext' created successfully
The system created an empty file 'file.txt'. If the file already exists it will be overwritten.

To create or update a file with text:
path 'C:/dir/file'
io.write path 'content of file `' + path + '` ...'
A file named 'file' was created with the text that was provided.

And reading a file:
path 'C:/dir/file'
text io.read path
print text
content of file 'C:/dir/file' ...
io.info is a system function that is used to get information about directories or files. Let's print the full information of a file 'A.EXT':
path 'C:/dir/A.EXT'
io.write path 'A'
print io.info path
 ok: true
 error: ''
 type: 'file'
 path: 'C:\dir\A.EXT'
 filename: 'A.EXT'
 name: 'A'
 ext: 'EXT'
 size: 4
 parentpath: 'C:\dir\'
 parentname: 'dir'
To get access to the information, it is needed to assign io.info record result to a predefined record variable:
path 'C:/dir/A.EXT'
invalidpath 'C:/dir/A'
inf { ok name '' error '' }
print 'read file ' + path
inf io.info path
print ( inf.ok ? inf.name inf.error )
print 'read file ' + invalidpath
inf io.info invalidpath
print ( inf.ok ? inf.name inf.error )
read file C:/dir/A.EXT

read file C:/dir/A
Unable to find the specified file.
We make use of inf record that is declared with the information key names that will be used in the program. ok is a property that is TRUE if information fetch ran successfully. If an invalid path is provided, io.error will hold the error.

Full description of file system management in Tyl is beyond the scope of this guide. Do refer to the IO Module page for reference of all file system functionalities, as well as to various pages in the guide that has file system activity.