Ness PHP File System Class
Required Namespace
  • Ness
    • IO
      • FileSystem

You can include this library to your code file by typing the below code;

use Ness\IO\FileSystem


About FileSystem Class #top

This class is used to run file system related commands.


Available Methods #top

isAvailable
FileSystem::isAvailable(String $path);
Check if file is available.
Return Boolean
Parameters $path String; File path and file name



ReadFile
FileSystem::ReadFile(String $path);
Read all contents of file
Return String
Parameters $path String; File path and file name



WriteFile
FileSystem::WriteFile(String $path, $contents);
Write all contents to file. Creates a new file if not exists
Return Boolean
Parameters $path String; File path and file name
$contents String; Contents to put



Append
FileSystem::Append(String $path, $contents);
Append new contents to file (*file must be created with WriteFile)
Return Boolean
Parameters $path String; File path and file name
$contents String; Contents to put



Delete
FileSystem::Delete(String $path);
Delete a file if exists
Return Boolean
Parameters $path String; File path and file name



Copy
FileSystem::Copy(String $path, $path_to);
Copy file
Return Boolean
Parameters $path String; File path and file name [source].
$path_to String; File path and file name [target]



getItemList
FileSystem::getItemList(String $path, string  $opt = SCANDIR_SORT_NONE )
Get item list
Return Array
Parameters $path String; Directory to list



getSize
FileSystem::getSize(String $path);
Get size of file
Return Integer
Parameters $path String; File path and file name



getPermissions
FileSystem::getPermissions(String $path);
Get permissions for file
Return Integer
Parameters $path String; File path and file name



getOwner
FileSystem::getOwner(String $path);
Get owner of file
Return Mixed
Parameters $path String; File path and file name



getType
FileSystem::getType(String $path);
Get type of file
Return Mixed
Parameters $path String; File path and file name



getTotalSpace
FileSystem::getTotalSpace(String $path);
Get total space available in directory
Return Integer
Parameters $path String; File path