Class FileSystem
Function to manage files and directories
Methods summary
public static
array
|
#
GetDirContent( string $path )
Get all the files and directories available on a specified path.
Get all the files and directories available on a specified path.
Parameters
Returns
array List of files found.
|
public static
boolean
|
#
MakeDir( string $directory, integer $mode = 0755, boolean $recursive = false )
Same as php mkdir() but adds Operating system check and replaces every / by \
on windows.
Same as php mkdir() but adds Operating system check and replaces every / by \
on windows.
Parameters
- $directory
string $directory The directory to create.
- $mode
integer $mode the permissions granted to the directory.
- $recursive
boolean $recursive Recurse in to the path creating neccesary directories.
Returns
boolean true on success false on fail.
|
public static
boolean
|
#
RecursiveCopyDir( string $source, string $target )
Copy a directory and its content to another directory replacing any file on
the target directory if already exist.
Copy a directory and its content to another directory replacing any file on
the target directory if already exist.
Parameters
- $source
string $source The directory to copy.
- $target
string $target The copy destination.
Returns
boolean true on success or false on fail.
|
public static
boolean
|
#
RecursiveRemoveDir( string $directory, string $empty = false )
Remove a directory that is not empty by deleting all its content.
Remove a directory that is not empty by deleting all its content.
Parameters
- $directory
string $directory The directory to delete with all its content.
- $empty
string $empty Removes all directory contents keeping only itself.
Returns
boolean True on success or false.
|
public
boolean
|
#
WriteFileIfDifferent( string $file, string & $contents )
Only saves content to a file if the new content is not the same as the
original. This is helpful to prevent an unneccesary timestamp modification which
is used by compilers to decide wether the file needs recompilation.
Only saves content to a file if the new content is not the same as the
original. This is helpful to prevent an unneccesary timestamp modification which
is used by compilers to decide wether the file needs recompilation.
Parameters
- $file
string $file Path to file.
- $contents
string $content New content of file.
Returns
boolean True on success or false if file content is the same.
|