Unix-lookalike dir listing

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Shendemiar
Forum Contributor
Posts: 404
Joined: Thu Jan 08, 2004 8:28 am

Unix-lookalike dir listing

Post by Shendemiar »

On my page i need to show the contents of a directory. I currently imitate loosely the looks uf unix shell. Is there an easy way to make perfect imitation, say actually executing "ls -la" and capturing the output, or a ready class that gives accurate match. I know it isnt too complicated to do oneself, just asking if its allready done or a simple way to use the actual.
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

well you can always do exec('ls -la') but i am not sure if you can grab that output or not. take a look at the exec() function and maybe try somthing like this

Code: Select all

$list = exec('ls -la');
echo $list;
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

Code: Select all

passthru('ls -la');
Post Reply