Directory constructor
public function \Bitrix\Main\IO\Directory::__construct( string $path string $siteId = nul );
Non-static method is called when creating a class instance, allowing to perform actions within it, when creating an object.
Parameters
Parameter | Description | Version |
---|---|---|
$path | Full path to folder | |
$siteId | Site ID |
Example
$directory=new \Bitrix\Main\IO\Directory($path, $siteId = null);
The following can be done with folder which path was passed to class constructor:
Check, if specified path exists:
$directory->isExists()
Delete the folder and all its contents:
$directory->delete()
Returns array with object of Directory and File classes, inserted into the current directory. Without recursion.
$directory->getChildren()
Create subdirectory wit name, passed as parameter. Returns a created folder object:
$directory->createSubdirectory($name)
Gets folder creation time. Here and later methods return the in the Unix timestamp format. Prints information on directory, specified when creating an object:
$directory->getCreationTime()
Gets time of the last access to folder:
$directory->getLastAccessTime()
Gets time of the last folder update:
$directory->getModificationTime()
Sets access permissions to folder:
$directory->markWritable()
Returns access permissions to folder:
$directory->getPermissions()