Find statment

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ajd335
    New Member
    • Apr 2008
    • 123

    Find statment

    Hi All,
    I am writing one find statement which gives me all the files related with the specific user name the user entered.
    my code looks like
    Code:
    <?php
    $title = "Grading Form";
    if(isset($_POST['fname'])) { $f1 =  $_POST['fname']; }
    if(isset($_POST['lname'])) { $l1 =  $_POST['lname']; }
    if(isset($_POST['add'])) { $a1 =  $_POST['add']; }
    if(isset($_POST['date'])) { $d1 =  $_POST['date']; }
    $fullname = $l1.","." ".$f1;
    
    $dirname = "/home/gr/ereports/O1"  ;
    $handle = opendir($dirname) or die('cant open');
    $ans = shell_exec([B]"find /home/gr/ereports/O1/$d1*  -name \"*.ps\"  -exec grep -i -e $fullname  {} \\; -print0[/B] ");
    echo $ans;
    ?>
    here I am getting all the files with the username as a string..If there are 4 files, I got all file's path as a single string.
    I want to make them seperate..May be an array or newline or something..And not as a whole string..Is it possible with some options adding in the FIND statment ?
    What can be done
Working...