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.
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.
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.
The mode is a zero, then the three numbers discussed on the CHMOD page.
Example :
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.
Example :
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"); |
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... |
| -b | a block device |
| -c | a character device |
| -d | a directory |
| -e | existing |
| -f | an ordinary file |
| -g | has a setgid |
| -k | has a sticky bit set |
| -l | a symbolic link |
| -o | owned by a current user |
| -p | a named pipe |
| -r | readable |
| -s | contains any information |
| -t | represents a terminal |
| -u | has a setuid |
| -w | writable |
| -x | exectuable |
| -z | empty |
| -A | how long it has been since the given was last accessed |
| -B | a binary file |
| -C | how long it has been since a file's inode has been accessed |
| -M | how long it has been since the given was modified. |
| -O | owned by the current user. The current user's ID is set at the time of login. |
| -R | readable by the current user. |
| -S | a socket. |
| -T | a text file. |
| -W | writable by the current user |
| -X | executable 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"; } |

