Files - 2 << Files - 3 >> Files - 4
This page will show a few different things you can do with files.

The rename command changes the name of an existing file. It also moves that file if you specify a different path.
rename ("existing_name.ext", "new_name.ext");

The unlink command deletes a file or list of files from the system. Be sure you want to do this. It permanently removes the files.
unlink ("filename.ext");

The chmod command controls the same chmod properties as you would do using your FTP program. It assigns or changes the chmod properties of a specified file.
chmod (mode, "filename.ext");
The mode is a zero, then the three numbers discussed on the CHMOD page.
Example :
chmod (0755, "example.txt");

In some cases, you may want to find the status of a file. These tools are sometimes referred to as the -x file tests because of the format you invoke them in. These tests are used along with a file handle to find a result.
letter...Determines if given is...
-ba block device
-ca character device
-da directory
-fan ordinary file
-ghas a setgid
-khas a sticky bit set
-la symbolic link
-oowned by a current user
-pa named pipe
-scontains any information
-trepresents a terminal
-uhas a setuid
-Ahow long it has been since the given was last accessed
-Ba binary file
-Chow long it has been since a file's inode has been accessed
-Mhow long it has been since the given was modified.
-Oowned by the current user. The current user's ID is set at the time of login.
-Rreadable by the current user.
-Sa socket.
-Ta text file.
-Wwritable by the current user
-Xexecutable by the current user.

Example :
# check to see if file exists
if (-e "output.txt"){
    print "The file actually exists! \n";
    } else {
    print "That file does not exist in the current directory \n";
Files - 2 << Files - 3 >> Files - 4

Advertise in the banner along the top, Click here!

Valid XHTML 1.0 Transitional Valid CSS! Text Link Ads