Documentation

CBXVirtualDirectory

CBXVirtualDirectory class is used to handle folders.

Class instance is not connected with physical folder, because the folder may be non-existent. Class instance can be retrieved by calling methods GetDirectory($path) or CreateDirectory($path) of CBXVirtualFile class instance.

$dir = $io->GetDirectory($io->RelativeToAbsolutePath("/folder1/folder2"));
$arChildren = $dir->GetChildren();
foreach ($arChildren as $child)
{
 if (!$child->IsDirectory() && $child->GetName() != ".access.php")
  die("Error");
};

Class methodsа

Method Description Available from version
GetName
string
CBXVirtualDirectory::GetName()
No parameters. Returns file name.
GetPath
string
CBXVirtualDirectory::GetPath()
No parameters. Returns file path.
GetPathWithName
string
CBXVirtualDirectory::GetPathWithName()
No parameters. Returns file name with path.
IsDirectory
bool
CBXVirtualDirectory::IsDirectory()
No parameters. Returns true.
IsExists
bool
CBXVirtualDirectory::IsExists()
No parameters. Returns true, if the file does not exist physically. Otherwise, returns false.
MarkWritable
void
CBXVirtualDirectory::MarkWritable()
No parameters. Marks file to be writable.
GetPermissions
int
CBXVirtualDirectory::GetPermissions()
No parameters. Returns access permissions for a file.
GetModificationTime
int
CBXVirtualDirectory::GetModificationTime()
No parameters. Returns time when a file was last modified.
GetLastAccessTime
int
CBXVirtualDirectory::GetLastAccessTime()
No parameters. Returns time when the file was last accessed.
GetChildren Method returns folder content as an array.
Create
bool
CBXVirtualDirectory::Create()
No parameters. Creates folder, if it doesn't exist. Returns true, if the folder is created or exists. Otherwise, returns false.
GetErrors
array
CBXVirtualDirectory::GetErrors()
No parameters. Returns array of error, occurred during last file operation.


© «Bitrix24», 2001-2024