File service offers limited access to the file system for operations such as copying or removing files.
File.copy(sourceFilePath: string, targetFilePath: string): boolean
targetFilePath. Any directory components in
targetFilePath that do not yet exist will be created. If
targetFilePath must be the counterpart of
sourceFilePath at the new location, not the new parent directory. This allows the copy to have a different name and is true even if
sourceFilePath is a directory.
Note: The file is not copied if the source file timestamp is older than the destination file timestamp. If you want to replace the newer file, you need to remove it first via File.remove().
File.exists(filePath: string): boolean
Returns true if and only if there is a file at
File.directoryEntries(path: string, filter: File.Filter): string
Returns a sorted list of the directory
path's contents non-recursively, filtered by
filter. The values of
filter are equivalent to Qt's
File.lastModified(filePath: string): number
Returns the time of last modification for the file at
filePath. The concrete semantics of the returned value are platform-specific. You should only rely on the property that a smaller value indicates an older timestamp.
File.makePath(path: string): boolean
Makes the directory at
path, creating intermediate directories if necessary. Conceptually equivalent to
File.move(oldPath: string, newPath: string, overwrite: boolean = true): boolean
Renames the file
true if successful; otherwise returns
false. If a file with the name
newPath already exists, and
false (that is, the file will not be overwritten).
File.remove(filePath: string): boolean
Removes the file at
filePath. In case of a directory, it will be removed recursively.
© 2018 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.