1.3. Filesystem API
The Filesystem API provides file system utilities.
Functions
-
function isdir(string path)
Check if the specified path is a directory.
- Parameters:
path – to check.
- Returns:
true if it’s a direcory, false otherwise.
-
function mkdir(string path)
Create the specified directory structure.
- Parameters:
path – the directory tree to create.
- Returns:
true on success, false otherwise.
-
function notEmptyFile(string filename)
Check if the specified file is not empty.
- Parameters:
filename – the file to check.
- Returns:
true if file is not empty, false otherwise.
-
function exists(string path)
Check if the specified file or directory exists.
- Parameters:
path – the path to check.
- Returns:
true if the path exists, false otherwise.
-
function fileLastChange(string filename)
Get the last time the specified file has changed.
- Parameters:
filename – the file to query.
- Returns:
last modification time on success, -1 otherwise.
-
function readdir(string path)
List directory files and dirs contents.
- Parameters:
path – the directory to traverse.
- Returns:
table (entry_name -> entry_name) on success, nil otherwise.
-
function rmdir(string path)
Recursively remove a file or directory.
- Parameters:
path – the path to remove.
-
function dumpBinaryFile(string path)
Dump a file contents to the webserver.
- Parameters:
path – the file path.
-
function setDefaultFilePermissions(string file_path)
Set the default ntopng file permissions on the given path.
Note
this function can fix some permission mismatches on Ubuntu 18.
- Parameters:
file_path – the path to the file
-
function deleteOldRRDs(string ifpath, int deadline)
Delete RRDs older than the specified deadline.
- Parameters:
ifpath – starting path for the delete operation
deadline – maximum modification date for the files