Jump to content


Store a directory in an Array and call in code?

  • Please log in to reply
No replies to this topic

#1 CaptSammy

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 13 September 2006 - 04:07 PM

I am trying to create a page that when run it does a "dir" on a windows share and finds a filename from the results that starts with ver and end with .txt (the actual page version is part of the filename). I have the parameters in a csv file, seemed easier than xml. Not having any luck, can someone shed some light and help me get this script running?

csv file:

php file:
<?php #Script - MyVerPage.php

// Create a multidimensional array from an external csv file

$CSVinput = fopen("MyCSV.csv", "r");
$MyArray = array();

while (list($shortID, $longID, $server, $rootshare) = fgetcsv($CSVinput, 1000, ",")) {
$MyArray[$inputKEY] = array(0 => $shortID, 1 => $longID, 2 => $server, 3 => $rootshare);


while ($i) {
  $chkcmd = $MyArray[$i][3];
  $d = dir($chkcmd);
  #find the filename from the dir list that starts with "ver" with extension ".txt" and assign to $result
  $MyArray[$i][4] = $result;
  echo $MyArray[$i][4];


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users