Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 1st, 2004, 10:03 AM
Registered User
 
Join Date: Jun 2003
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default EXEC function not returning values

I wrote a PHP page that goes out and searches a directory on our main fileserver for files that match search criteria a user inputs. I use the exec() function to run the search, and have the results returned into an array of $find_output. This page and function worked last week, but is not anymore for some reason. Here is the code:

    $directory = "N:\\Dir1\\SubDir1\\SubDir2\\SubDir3";
    $fname = preg_replace('/[^a-zA-Z0-9\-]/', '', $filename);
    $fname = $fname."*.*";
    $dirname = "$directory\\$fname";
    $find_output = array();
    exec("dir $dirname /s /a:-d /b",$find_output);
    print_r($find_output);

The $filename is the file name that they are looking for, such as "bkb333". The "print_r($find_output)" statement just returns Array(). But I run the dir statement in a cmd window, and it returns 5 files. Any suggestions? Or examples of how I can do this better? I need to output a list of files returned from the search so that the user can select which ones they want, and have them emailed to them. Any better way to do this would be appreciated.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Function not returning value civa Access 5 January 17th, 2006 03:44 AM
Error handle - stop exec. of parent function crisan Access 2 September 27th, 2005 01:55 AM
Copy a image file using exec function foka PHP How-To 1 May 29th, 2005 04:46 PM
EXEC function ajutla Beginning PHP 0 August 19th, 2004 09:18 AM
Function not returning anything... goatboy Beginning PHP 2 December 1st, 2003 12:34 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.