Полезная информация

Webmaster in a Nutshell

Previous Chapter 15
Perl Quick Reference
Next
 

15.16 File Operations

Functions operating on a list of files return the number of files successfully operated upon.

chmod list

Changes the permissions of a list of files. The first element of the list must be the numerical mode.

chown list

Changes the owner and group of a list of files. The first two elements of the list must be the numerical uid and gid.

truncate file, size

Truncates file to size. file may be a filename or a filehandle.

link oldfile, newfile

Creates a new filename linked to the old filename.

lstat file

Like stat, but does not traverse a final symbolic link.

mkdir dir, mode

Creates a directory with given permissions. Sets $! on failure.

readlink expr(dagger)

Returns the value of a symbolic link.

rename oldname, newname

Changes the name of a file.

rmdir filename(dagger)

Deletes the directory if it is empty. Sets $! on failure.

stat file

Returns a 13-element array (0:$dev, 1:$ino, 2:$mode, 3:$nlink, 4:$uid, 5:$gid, 6:$rdev, 7:$size, 8:$atime, 9:$mtime, 10:$ctime, 11:$blksize, 12:$blocks). file can be a filehandle, an expression evaluating to a filename, or _ to refer to the last file test operation or stat call. Returns a null list if the stat fails.

symlink oldfile, newfile

Creates a new filename symbolically linked to the old filename.

unlink list

Deletes a list of files.

utime list

Changes the access and modification times. The first two elements of the list must be the numerical access and modification times.


Previous Home Next
File Test Operators Book Index Input/Output

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell