Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Files In Folders Questions 1

Status
Not open for further replies.

likelylad

IS-IT--Management
Joined
Jul 4, 2002
Messages
388
Location
GB
I have a page that a user enters a file name.
The program will then search for this file in folder 1, do whatever processing needs to be and create another file in folder 2.
Finally the file in folder 1 is deleted by the program.

Question 1
How can I get the program to look for all files in folder 1 and process them one at a time. Basically I do not want the user to have to type in a file name all the time.

Question 2
At the moment folder 2 is on a local drive. What I would like to do, is for this drive to be a network drive.
I have tried mapping a drive.
I have tried using \\otherserver\destination_folder.
The problem is not user rights as I have Admin rights on both machines.

Thanking in advance for any help received
 
There is some unclarity here, so allow me to ask a question:

You know that PHP runs server side. That means the folders you are talking about are somwhere reachable through the server filesystem. Right?

You say the second drive is local. How would that drive be accessible to the server? It needs to be a server addressable drive - your info looks like you use Windows - that is furnished with the proper rights for the user under which the web server runs.

 
You are right in assuming PHP is running on a windows system
On the PHP Server, I have 2 folders.
c:\folder1 and c:\folder2

Folder1 contains text files before processing.
Folder2 contains text files after processing.

I would like folder2 to be \\otherserver\folder2
 
Here's a function to find all the files in a directory, sorry for just posting code, but this is one example where that's just easiest... the relevant functions are...
opendir();
readdir();

Code:
$dir_handle=opendir($path);
while ($entry = readdir($dir_handle)) {
  if (is_file($path."/".$entry)) {
    //$entry is your file name, do whatever you want with it
  }
}

As far as your accessible drives issue, with all do respect, I'm willing to bet it is a permissions issue. Doesn't matter if you have admin rights to both machines, what rights does your webserver have to the drives?

When you're talking about local/network drives, I'm unclear what you mean by local, do you mean local to you, the user, or the webserver? If you're running apache, the user is SYSTEM by default, though you can change it, if you want you can go ahead and make it you... though I would suggest leaving it as some sort of special user. If you're running MS's webserver (which I'm drawing a blank on) your username is something funky that I can't remember now, but you'll see it in your user manager (on the web server) and can mess with permissions there.

Of course after writing all that, I'm thinking c:\folder2 is on the webserver, and you want to view it from your other machine... in which case you're purely talking about a windows sharing issue, which I'd suggest posting in the forum for whichever version of windows you're running.

-Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top