File::parent()

Gets the file’s parent folder.

Table of Contents
  1. Description
  2. Example

Description

File::parent(): ?Folder;

This method returns the file’s parent folder path as a Folder instance if the file exists, otherwise, it returns null.

Example

$file = new File('.\path\to\file.txt');

$folder = $file->parent()->path; // Returns `'.\path\to'`

File::parent()

Gets the file’s parent folder.

File::size()

Gets the file sizes in human readable string format.