MQLArticles/Utils/File/README.md
2026-09-06 11:15:27 -05:00

21 lines
959 B
Markdown

[← Utils](../README.md)
# Utils/File
File and path handling utilities: extensions, directory parsing, and folder creation relative to the MQL5\Files sandbox.
## Main features
- Extract/validate file extensions and pure file names (`FileGetExtension`, `FileHasExtension`, `GetPureFileName`, `FileRemoveExtension`, in `File.mqh`).
- Get the directory portion of a path (`PathGetDirectory`).
- Create a folder relative to the terminal's data or common `MQL5\Files` path (`CreateFolder` in `Path.mqh`).
- Folder-level operations — cleaning and encrypting a folder's contents (`CFolderOpsClean`, `CFolderOpsEncrypt`, built on `CFolderOpsBase` in `FolderOps/`).
## Basic usage
```mql5
string ext = FileGetExtension("report_final.csv"); // "csv"
string name = GetPureFileName("C:\\path\\report_final.csv"); // "report_final.csv"
CreateFolder("MyBotLogs", false); // creates MQL5\Files\MyBotLogs
```
> Only the most representative functions are shown here.