Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Programming/Scripts

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 1st October 2013, 10:23
LinuxAdminWannaBe LinuxAdminWannaBe is offline
Junior Member
 
Join Date: Oct 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
 
Unhappy PHP script to omit root owned files

Hi guys,

I have created a PHP script for listing files and redirect it on a txtfile. This is only successful if i search a location which is non root. How could i update it to omit those root owned files.

Appreciate your help.
Thanks

PHP Code:
<?php

// FIND .tar FILES AND SAVE IN A TEXT //

function ob_file_callback($buffer)
  {
    global 
$ob_file;
    
fwrite($ob_file,$buffer);
  }

$ob_file fopen('tarfile.txt','w');
ob_start('ob_file_callback');


  
$Loc="/";

  function 
Find($Path)
    { 
      
$Find="find $Path -path '*.tar'";
      
exec($Find,$output,$return_var);
      return 
$output;    
    }

  
$result Find($Loc);
      if 
$result 
      
  
foreach($result as $single
  
printf("%s \n",$single);
  return 
$single;


ob_end_flush()

?>
Reply With Quote
Sponsored Links
Reply

Bookmarks

Tags
php

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
automatic webmail link admins Installation/Configuration 16 22nd June 2009 16:42
Missing Email dayjahone General 7 30th June 2008 15:29
Wrong steps by upgrading ISPC Berry Installation/Configuration 14 14th November 2007 16:27
Apache - Virtual hosts - ISPConfig Hans Server Operation 8 23rd April 2006 16:29
cannot connect to ispconfig guidovanh Installation/Configuration 22 3rd March 2006 19:52


All times are GMT +2. The time now is 06:10.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.