WordPress at a glance

File system (create delete files folders) (tag)

copy_dir()

Copies a directory from one location to another via the WordPress Filesystem Abstraction.

get_dirsize()

Gets the size of a directory in bytes. The result is cached to temporary options: get_transient().

list_files()

Returns a listing of all files in the specified folder and all subdirectories up to 100 levels deep. The depth of the recursiveness can be controlled by the $levels param.

recurse_dirsize()

Get the size of a directory recursively.

unzip_file()

Unzips a specified ZIP file to a location on the Filesystem via the WordPress Filesystem Abstraction. Assumes that WP_Filesystem() has already been called and set up. Does not extract a root-level __MACOSX directory, if present.

wp_delete_file()

Delete a file. This function is a wrapper for PHP's unlink() function — it uses wp_delete_file filter before deleting a file.

wp_delete_file_from_directory()

Deletes a file if its path is within the given directory.

wp_mkdir_p()

Recursive directory creation based on full path.

wp_tempnam()

Returns a filename of a Temporary unique file. Please note that the calling function must unlink() this itself.