File is a GeneXus data type that allows you to manage system files. It makes it easier to develop applications that need to execute actions that affect system files.
The File data type enables system file management. It can be used for typical operations such as copying, moving, renaming and deleting files. You can also use File data type to get file attributes such as modification, date, time and size.
||Assign a path to the file. The source cannot be read, use GetAbsoluteName(*) instead.
||Returns the name separator character depending on the OS.
||Returns the result of the last operation.
||Returns the result description of the last operation.
||Copies the specified file to a new file.
||Deletes the specified file.
||Determines whether the specified file exists.
||Returns the name of the specified file.
||Returns the full path name of the specified file.
||Returns the path of the parent directory.
||Renames the specified file.
||Returns the date and time the specified file was last modified.
||Gets the size of the specified file.
||see more details
||see more details
Copies the file specified in source to a new location. If the target file already exists, it will be overridden.
New filename (Character)
Deletes the file specified in source.
Checks whether the file specified in source exists
msg("The file exists!")
msg("The file does not exist!")
Returns the name of the file specified in source.
Msg(&file.GetName()) // screen shows: myFile.txt
Return the absolute name of the file specified in source.
Msg(&file.GetAbsoluteName()) // screen shows: c:\empmyFile.txt
Returns the path of the parent directory.
&parentDir = &file.getPath()
Renames the file specified in source. It can also be used to move the file, changing its current path.
New name of the file (Character)
Returns the date and time the file specified in source was last modified.
&dateTime = &file.GetLastModified()
Returns the size (in bytes) of the file specified in source.
&size = &file.GetLength()
||Operation completed successfully.
||Invalid file instance - if source property was not set.
||File does not exist.
||File already exists.
File data type handles files that are in the local file system by default. But when it is returned by a method of the Storage Provider API, then it refers to a file located in the external storage.
If it is returned by the GetFiles() method of the Directory data type and that is a returned by the GetDirectories() method in the Storage Provider API, then it refers to a file located in the external storage too.
File data type: Text file handling
Storage Provider API