Complete List of PHP 5 File system Functions

Editorial Staff - - PHP Tutorials


This is a basic PHP program which describes How to get the number of days of the current month. Below examples will help you in the better understanding of the basic concept of PHP programming language.

The Filesystem functions allow us to manipulate the folders & files from the particular directory.

Complete List of PHP 5 Filesystem Functions

Below is the complete list of PHP 5 functions which are used for filesystem management.

PHP FunctionDescription
basename()Returns the filename
chgrp()Change the file group
chmod()Change the file permission
chown()Change the file ownership
clearstatcache()Clears the file status cache
copy()Copies a file
dirname()Returns the directory name component of a path
disk_free_space()Returns the free space of a directory
disk_total_space()Returns the directory size
fclose()Closes an open file
feof()Tests for end-of-file on an open file
fflush()Flushes buffered output to an open file
fgetc()Returns a character from an open file
fgetcsv()Parses a line from an open file, checking for CSV fields
fgets()Returns a line from an open file
fgetss()Returns a line, with HTML and PHP tags removed, from an open file
file()Reads a file into an array
file_exists()Checks whether or not a file or directory exists
file_get_contents()Reads a file into a string
file_put_contents()Writes a string to a file
fileatime()Returns the last access time of a file
filectime()Returns the last change time of a file
filegroup()Returns the group ID of a file
fileinode()Returns the inode number of a file
filemtime()Returns the last modification time of a file
fileowner()Returns the user ID (owner) of a file
fileperms()Returns the permissions of a file
filesize()Returns the file size
filetype()Returns the file type
flock()Locks or releases a file
fnmatch()Matches a filename or string against a specified pattern
fopen()Opens a file or URL
fpassthru()Reads from an open file, until EOF, and writes the result to the output buffer
fputcsv()Formats a line as CSV and writes it to an open file
fputs()Alias of fwrite()
fread()Reads from an open file
fscanf()Parses input from an open file according to a specified format
fseek()Seeks in an open file
fstat()Returns information about an open file
ftell()Returns the current position in an open file
ftruncate()Truncates an open file to a specified length
fwrite()Writes to an open file
glob()Returns an array of filenames / directories matching a specified pattern
is_dir()Checks whether a file is a directory
is_executable()Checks whether a file is executable
is_file()Checks whether a file is a regular file
is_link()Checks whether a file is a link
is_readable()Checks whether a file is readable
is_uploaded_file()Checks whether a file was uploaded via HTTP POST
is_writable()Checks whether a file is writeable
is_writeable()Alias of is_writable()
lchgrp()Changes group ownership of symlink
lchown()Changes user ownership of symlink
link()Creates a hard link
linkinfo()Returns hard link information
lstat()Returns symbolic link information
mkdir()Creates a directory
move_uploaded_file()Moves an uploaded file
parse_ini_file()Parses a configuration file
parse_ini_string()Parses a configuration string
pathinfo()Returns file path information
pclose()Closes a pipe
popen()Opens a pipe
readfile()Reads and writes a file
readlink()Returns symbolic target link
realpath()Returns the absolute pathname
realpath_cache_get()Returns realpath cache entries
realpath_cache_size()Returns realpath cache size
rename()Renames a file or directory
rewind()Rewinds a file pointer
rmdir()Removes an empty directory
set_file_buffer()Sets the buffer size of an open file
stat()Returns information about a file
symlink()Creates a symbolic link
tempnam()Creates a unique temporary file
tmpfile()Creates a unique temporary file
touch()Sets access and modification time of a file
umask()Changes file permissions for files
unlink()Deletes a file