next up previous contents
Next: User Information Functions Up: Interacting with the Operating Previous: Environmental Variables   Contents


File and Directory Manipulation Functions

Perl provide a goodly number of functions for manipulating directories and files. Often using these functions eliminate the need to use the system function to invoke an external process; in addition, these functions are simply more convenient in many cases. The functions are summarized in Table [*].

Table: Functions for File and Directory Manipulation
Name Use Arguments
chdir Change current directory scalar directory name
chmod Change permissions on files scalar(mode), list of filenames
chown Change ownership of files scalar(uid),scalar(gid),list of files
link Create hard link to a file scalar(old file),scalar(newfile)
mkdir Create a new directory scalar(filename), scalar(mode)
rename Rename a file scalar(oldname),scalar(newname)
rmdir Remove a directory scalar(filename)
umask Display or set umask scalar(umask)
unlink Remove a file list of filenames


Like most perl functions, many of the functions in Table [*] will use the default argument $_ when called without any arguments, and will return a non-zero value when they are successful, but you should consult perldoc (i.e. perldoc -f function) if there is any doubt.


next up previous contents
Next: User Information Functions Up: Interacting with the Operating Previous: Environmental Variables   Contents
Phil Spector 2002-10-18