directories
|directory list with exec
using exec() to produce a directory listing
full source of directory list with exec [ line 1 - 24 ] | download directory list with exec
| 1 | <?php |
| 2 | exec('ls -al .', $output, $return ); |
| 3 | /* |
| 4 | when you use the -l flag w/ ls, there will be a string of characters on the left for each file, which may look something like -rwxr-xr-x |
| 5 | the first character describes what the item is: |
| 6 | - = regular file |
| 7 | d = directory |
| 8 | b = special block file |
| 9 | c = special character file |
| 10 | l = symbolic link |
| 11 | p = named pipe special file |
| 12 | example: lrwxr-xr-x would be a symbolic link |
| 13 | the next 9 characters are 3 groups of 3 characters each, which tell the read/write/execute permissions for user, group, and other respectively: |
| 14 | r = read |
| 15 | w = write |
| 16 | x = execute |
| 17 | using the above example of lrwxr-xr-x, you would have symbolic link file, where the user can read, write and execute (rwx), and the group and others can read and execute (r-x) |
| 18 | */ |
| 19 | echo '<p>Returned: '.$return.'</p>'; |
| 20 | foreach ( $output as $file ) |
| 21 | { |
| 22 | echo $file.'<br>'; |
| 23 | } |
| 24 | ?> |
22 hits by 19 users in the last 30 minutes.