By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,712 Members | 1,466 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,712 IT Pros & Developers. It's quick & easy.

Find statment

100+
P: 123
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
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $title = "Grading Form";
  3. if(isset($_POST['fname'])) { $f1 =  $_POST['fname']; }
  4. if(isset($_POST['lname'])) { $l1 =  $_POST['lname']; }
  5. if(isset($_POST['add'])) { $a1 =  $_POST['add']; }
  6. if(isset($_POST['date'])) { $d1 =  $_POST['date']; }
  7. $fullname = $l1.","." ".$f1;
  8.  
  9. $dirname = "/home/gr/ereports/O1"  ;
  10. $handle = opendir($dirname) or die('cant open');
  11. $ans = shell_exec("find /home/gr/ereports/O1/$d1*  -name \"*.ps\"  -exec grep -i -e $fullname  {} \\; -print0 ");
  12. echo $ans;
  13. ?>
  14.  
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
Sep 18 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.