1. ls 명령 수행 예시

<?php

$directory = '/path/to/directory';
$output = shell_exec('ls ' . escapeshellarg($directory));
echo "<pre>$output</pre>";

?>

 

2. find 명령 수행 예시

<?php

$directory = '/path/to/directory';
$output = shell_exec("find $directory -type f");
echo "<pre>$output</pre>";

?>