# final class \SmartGetFileSystem
{ } ->

Class: SmartGetFileSystem - provides the File System Get/Scan functions.
This class requires the use of RELATIVE PATHS to force using correct path access in a web environment application.
Relative paths must be relative to the web application folder as folder: `some-folder/` or file: `some-folder/my-file.txt`.
Absolute paths are denied by internal checks as they are NOT SAFE in a Web Application from the security point of view ...
Also the backward path access like `../some-file-or-folder` is denied from the above exposed reasons.
Files and Folders must contain ONLY safe characters as: `[a-z] [A-Z] [0-9] _ - . @ #` ; folders can also contain slashes `/` (as path separators); no spaces are allowed in paths !!

- Language: PHP
- Located at: lib/core/lib_filesys.php
- Package: Application:FileSystem
- Namespace: \
- Class Name: SmartGetFileSystem
- Version: v.20240119
- Depends: classes: Smart
- Hints: This class can handle thread concurency to the filesystem in a safe way by using the LOCK_EX (lock exclusive) feature on each file written / appended thus making also reads to be safe
- Usage: dynamic object: (new Class())->method() - This class provides only DYNAMIC methods

## class Methods

public function __construct ( bool $list_files_and_dirs = false, bool $allow_protected_paths = false ) {} @
public function get_storage ( string $dir_name, bool $recurring = true, bool $include_dot_files = false, string $search_pattern = "" ) {} -> ARRAY
public function search_files ( bool $recurring, string $dir_name, bool $include_dot_files, string $search_pattern, int $limit_search_files, string $search_prevent_file = "", string $search_prevent_override = "" ) {} -> ARRAY

## class Properties

## class Constants

## Sample code: PHP

`

    <?php

    // Get Storage example:
     $filesys = new SmartGetFileSystem(true);
     $data = $filesys->get_storage('my_dir/my_subdir');
     print_r($data);

     // Search for Files example:
     $obj = new SmartGetFileSystem();
     $arr = $obj->search_files(true, 'uploads/', false, '.svg', 100);
     print_r($arr);

    // #end php code

`

documentation generated on: 2024-12-16 16:53:45 +0000

Smart.Framework © 2009-2024 unix-world.org