Take this do...while loop:
do{
//FTP connect was correctly set above these lines -- now we're going to get the files
//create file on computer to download to
$filename = @fopen("c:\Directory\$list[$i]", "w");
//download file
ftp_fget ($conn_id, $filename, "$list[$i]", FTP_BINARY);
//unzip the file using filename without the ".ZIP" -- requirement of unzip.exe
$unzipFile = str_replace(".ZIP", "", $list[$i]);
exec("unzip.exe -oqq -d c:\directory\temp c:\directory\$unzipFile");
//print out name of downloaded file
echo "$list[$i]";
echo " -- downloaded and unzipped<br>";
$i++;
}while($list[$i]);
Although the files are downloaded properly from the FTP server, I can't get the exec line to work properly. If I place it BELOW the line <<echo " -- downloaded ..." >>, it will unzip all files EXCEPT the first one downloaded. If I place it where it's positioned now, it won't unzip anything. AND, in any case, it sometimes doesn't unzip no matter where's it's placed, for some mysterious reason. Am I doing something wrong here?
Thanks for any help.
--Brent