Provides functions for dealing with files
chmod(string $filename, int $mode) : bool
string
the name and path of the file
int
the new access mode
\cInvalidArgumentException |
if the file with the given filename does not exist |
---|
bool
true on successcopy(string $filename, string $destination) : bool
string
the name and path of the file
string
the destination. Note that existing files get overwritten
\cInvalidArgumentException |
if the file with the given filename does not exist |
---|
bool
true on successcreate(string $filename, string $content) : bool
string
the name and path of the new file
string
optional content of the new file. Optional.
bool
true on success. Otherwise false.exists(string $filename) : bool
string
the name and path of the file
bool
true if the file existsgetExtension(string $basename) : string
string
string
info(string $filename) : array
Currently following elements are in it: 'size' - the file size (in byte) 'atime' - the time the file was last accessed (unix timestamp) 'ctime' - time the file was created (unix timestamp) 'mtime' - time the file was last modified (unix timestamp) 'perms' - permissions of the file represented in 4 octal digits 'extension' - the file extension or '' if there's no extension 'mime' - the mime type of the file
string
the name and path to the file
\cInvalidArgumentException |
if the file with the given filename does not exist |
---|
array
Returns an array containing information about the filemove(string $filename, string $destination) : bool
string
the name of the source file
string
the destination. Note that the file can also be renamed in the process of moving it
\cInvalidArgumentException |
if the file with the given filename does not exist |
---|
bool
true on successread(string $filename, int $length, int $offset, bool $reverse) : string
string
the name and path of the file
int
the number of bytes to read. Optional.
int
this will be the first byte which is read. Optional.
bool
if true, the function will start from the back of the file. Optional.
\cInvalidArgumentException |
if the file with the given filename does not exist |
---|
string
bool success it returns the bytes which have been read.
Otherwise false.readLine(string $filename, int $lines, int $lineoffset) : string
string
the name and path of the file
int
the number of lines to be read. Optional.
int
this will be the first line which is read. Optional.
\cInvalidArgumentException |
if the file with the given filename does not exist |
---|
string
array bool one line was read the function will return it.
If more than one line was read the function will return an array
containing the lines. Otherwise false is returnedreadable(string $filename) : bool
string
the name and path of the file
\cInvalidArgumentException |
if the file with the given filename does not exist |
---|
bool
true if the file is readablerecursiveRmdir(string $dirname) : bool
string
the name of the directory which should be deleted
bool
true on success or false on failureremove(string $filename) : bool
string
the name and path of the file
\cInvalidArgumentException |
if the file with the given filename does not exist |
---|
bool
true on successrename(string $filename, string $new_filename) : bool
string
the name and path of the file
string
the new name of the file
\cInvalidArgumentException |
if the file with the given filename does not exist |
---|
bool
true on successsetDefaultDirPerms(string $pathname) : boolean
string
the name of the directory
boolean
true on success or false on failuresetDefaultFilePerms(string $filename) : boolean
string
the name of the file
boolean
true on success or false on failuretruncate(string $filename) : bool
string
the name and path of the file
\cInvalidArgumentException |
if the file with the given filename does not exist |
---|
bool
true on successvalidateFilename(string $filename, boolean $notifyAndExitOnFailure) : boolean
string
the filename to validate
boolean
if set, function will show a notification and will exit the script
boolean
true if the given filename is valid, false otherwisewrite(string $filename, string $content, bool $append) : bool
string
the name and path of the file
string
the data which should be written
bool
if true the data will be appended to the file. Optional.
bool
true on success, false otherwisewriteLine(string $filename, string $content, bool $append) : bool
see | $content, $append) |
---|
string
the name and path to the file
string
the data of the line
bool
if true the data will be appended to file. Optional.
bool
true on success, false otherwisewriteable(string $filename) : bool
string
the name and path of the file
bool
true if the file can be written