libperun

Class std.io.FileSystem

Synopsis

public static class FileSystem

A static class containing methods relating to the file system.

Fields

Constructors

Methods

public static DateTime getAccessTime(String path);

Get the last access time of the specified file or directory.

Arguments
pathPath to the file or directory, in the system's native path format.
Returns

A DateTime object indicating the last access time.

public static DateTime getAccessTime(Path path);

Get the last access time of the specified file or direcotry.

Arguments
pathPath to the file or directory.
Returns

A DateTime object indicating the last access time.

public static DateTime getModificationTime(String path);

Get the last modification time of the specified file or directory.

Arguments
pathPath to the file or directory, in the system's native path format.
Returns

A DateTime object indicating the last access time.

public static DateTime getModificationTime(Path path);

Get the last modification time of the specified file or directory.

Arguments
pathPath to the file or directory.
Returns

A DateTime object indicating the last access time.

public static void createDirectory(String path);

Create a new directory.

The parent directory must already exist, and the directory itself must not.

Arguments
pathPath to the directory to be created.
Throws
std.io.IOErrorIf the creation failed.
public static void createDirectory(Path path);

Create a new directory.

The parent directory must already exist, and the directory itself must not.

Arguments
pathPath to the directory to be created.
Throws
std.io.IOErrorIf the creation failed.
public static bool isDirectory(String path);

Determine if the specified path names an (accessible) directory.

This function returns true if the path refers to a directory, and false is ALL other cases, including if the path cannot be accessed, or does not exist, etc. It never throws exceptions!

Arguments
pathPath to be checked.
Returns

true if the path refers to a directory.

public static bool isDirectory(Path path);

Determine if the specified path names an (accessible) directory.

This function returns true if the path refers to a directory, and false is ALL other cases, including if the path cannot be accessed, or does not exist, etc. It never throws exceptions!

Arguments
pathPath to be checked.
Returns

true if the path refers to a directory.

public static bool exists(Path path);

Determine if the specified path refers to an existing accessible object.

This function returns true if the path is either a directory, or a file which could be opened. It returns false in all other cases, and never throws exceptions.

Arguments
pathPath to be checked.
Returns

true if the path refers to an existing accessible object.

public static bool exists(String path);

Determine if the specified path refers to an existing accessible object.

This function returns true if the path is either a directory, or a file which could be opened. It returns false in all other cases, and never throws exceptions.

Arguments
pathPath to be checked.
Returns

true if the path refers to an existing accessible object.

public static void createDirectoryProgressively(Path path);

Create a directory, and any parent directories if they don't yet exist.

If the directory already exists, nothing happens. If one of the would-be parents exists but is not a directory, an IOError is thrown.

Throws
std.io.IOErrorIf one of the parents is not a directory.
public static void createDirectoryProgressively(String path);

Create a directory, and any parent directories if they don't yet exist.

If the directory already exists, nothing happens. If one of the would-be parents exists but is not a directory, an IOError is thrown.

Throws
std.io.IOErrorIf one of the parents is not a directory.