This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v19.8
File

File 


 

File ( path | 4Dfile {; pathType | *} ) -> Function result 
Parameter Type   Description
path | 4Dfile  Text, Longint in File path or 4D file constant
pathType | *  Longint, Operator in If path passed: fk posix path (default) or fk platform path
If 4Dfile passed: * to return file of host database
Function result  Object in New file object

The File command creates and returns a new object of the File type. The command accepts two syntaxes. 

In the path parameter, pass a file path string. You can use a custom string or a filesystem (e.g., "/DATA/myfile.txt").

Note: Only absolute pathnames are supported with the File command. For more information, please refer to the File and folder object pathnames page. 

By default, 4D expects a path expressed with the POSIX syntax. If you work with platform pathnames (Windows or macOS), you must declare it using the pathType parameter. The following constants are available in the File and Folder constant theme:

Constant Type Value Comment
fk platform path Longint 1

Path expressed with a platform-specific syntax (mandatory in case of platform pathname)

fk posix path Longint 0

Path expressed with POSIX syntax (default)

 

In the 4Dfile parameter, pass a 4D built-in or system file, using one of the following constants:  

Constant Value Comment
Backup history file 19

Backup history file (see Configuration and trace files). Stored in the backup destination folder. 

Backup log file 13

Current backup journal file. Stored in the Logs folder next to database structure file.

Backup settings file 18

Default backup.4DSettings file (xml format), stored in the Settings folder of the database

Backup settings file for data 17

backup.4DSettings file (xml format) for the data file, stored in the Settings folder of the data folder

Build application log file 14

Current log file in xml format of the application builder. Stored in the Logs folder next to database structure file. 

Build application settings file 20

Default settings file of the application builder ("buildApp.4DSettings"). Stored in the Settings folder of the database. 

Compacting log file 6

Log file of the most recent compacting done with the Compact data file command or the Maintenance and security center. Stored in the Logs folder next to database structure file.

Current backup settings file 1

backup.4DSettings file currently used by the application. It can be the backup settings file (default) or a custom user backup settings file defined for the data file

Debug log file 12

Log file created by the SET DATABASE PARAMETER(Debug log recording) command. Stored in the Logs folder next to database structure file. 

Diagnostic log file 11

Log file created by the SET DATABASE PARAMETER(Diagnostic log recording) command. Stored in the Logs folder next to database structure file. 

Directory file 16

directory.json file, containing the description of users and groups (if any) for the project database. It can be located either in the user database settings folder (default, global to the project), or in the data settings folder (specific to a data file). 

HTTP debug log file 9

Log file created by the WEB SET OPTION(Web debug log) command. Stored in the Logs folder next to database structure file. 

HTTP log file 8

Log file created by the WEB SET OPTION(Web log recording) command. Stored in Logs folder next to database structure file. 

IMAP Log file 23

Log file created by the SET DATABASE PARAMETER(IMAP Log) command. Stored in the Logs folder of the database

Last backup file 2 Last backup file, named <databaseName>[bkpNum].4BK, stored at a custom location.
Last journal integration log file 22

Full pathname of the last journal integration log file (stored in the Logs folder of the restored application), if any. This file is created, in auto-repair mode, as soon as a log file integration occurred (see Automatic Restore).

Repair log file 7

Log file of database repairs made on the database in the Maintenance and Security Center (MSC). Stored in the Logs folder next to database structure file. 

Request log file 10

Standard client/server request log file (excluding Web requests) created by the SET DATABASE PARAMETER(4D Server log recording) or SET DATABASE PARAMETER(Client log recording) commands. If executed on the server, the server log file is returned (stored in the Logs folder on the server). If executed on the client, the client log file is returned (stored in the client local Logs folder). 

SMTP log file 15

Log file created by the SET DATABASE PARAMETER(SMTP Log) command. Stored in the Logs folder next to database structure file. 

User settings file 3

settings.4DSettings file for all data files, stored in Settings folder next to database structure file if enabled.

User settings file for data 4

settings.4DSettings file for current data file, stored in Settings folder next to the data file.

Verification log file 5

Log files created by the VERIFY CURRENT DATA FILE and VERIFY DATA FILE commands or the Maintenance and Security Center (MSC). Stored in the Logs folder next to database structure file. 

If the target 4Dfile does not exist, a null object is returned. No errors are raised.

If the command is called from a component, pass the optional * parameter to get the path of the host database. Otherwise, if you omit the * parameter, a null object is always returned.  



See also 

Folder
Get 4D file
Object to path
Path to object

 
PROPERTIES 

Product: 4D
Theme: File and Folder
Number: 1566

This command can be run in preemptive processes

 
PAGE CONTENTS 
 
HISTORY 

Created: 4D v17 R5

 
ARTICLE USAGE

4D Language Reference ( 4D v19)
4D Language Reference ( 4D v19.1)
4D Language Reference ( 4D v19.4)
4D Language Reference ( 4D v19.5)
4D Language Reference ( 4D v19.6)
4D Language Reference ( 4D v19.7)
4D Language Reference ( 4D v19.8)