On Sat, 31 Jul 2004 18:07:07 -0600, C.F. Scheidecker Antunes <[EMAIL PROTECTED]> wrote: > Hello, > > In order to get the filenames from the output below I have tried the > following: > > preg_match_all('/inflating:"(.*?)"/', $stdout, $matches);
Why do you have " around the (.*?)? The sample text below doesn't have ". Also, you can use ^ for the beginning of the line and $ for the end if you use the m modifier. preg_match_all('/^inflating:(.*)$/m', $stdout, $matches); > print_r($matches); > return $matches[1]; > > But I only get empty arrays with it. > > I need to fix that so I can have the filenames stored on arrays and also > evaluate the type of output according to > the situations ilustrated bellow. > > Contents of $stdout: > > unzip test.zip > Archive: test.zip > inflating: arch1.txt > inflating: arch2.txt > inflating: arch3.txt > inflating: arch4.txt > inflating: arch5.txt > inflating: arch6.txt > > The same I have from a pkware execution : > > pkunzip teste.zip > PKZIP(R) Version 6.0 FAST! Compression Utility for Linux X86 > Copyright 1989-2002 PKWARE Inc. All Rights Reserved. Evaluation Version > PKZIP Reg. U.S. Pat. and Tm. Off. Patent No. 5,051,745 > > Extracting files from .ZIP: teste.zip > Inflating: arch1.txt > Inflating: arch2.txt > Inflating: arch3.txt > Inflating: arch4.txt > Inflating: arch5.txt > > So, I need some help on how to write a regexp to get the values after > inflating, that is the filenames, and put them in an array. Both outputs > above are stored on a $stdout php variable. > > Also, I need to be able to indentify errors with the unzip utility that > does not support some types of zip file, the output is like this: > > unzip test1.zip > Archive: test1.zip > skipping: test1.txt `shrink' method not supported > > There's a skipping instead of a inflating or Inflating in pkware. > > The third situation is an error on the zip file itself : > > unzip test2.zip > Archive: test2.zip > End-of-central-directory signature not found. Either this file is not > a zipfile, or it constitutes one disk of a multi-part archive. In the > latter case the central directory and zipfile comment will be found on > the last disk(s) of this archive. > unzip: cannot find zipfile directory in one of test2.zip or > test2.zip.zip, and cannot find test2.zip.ZIP, period. > > or > > pkunzip test2.zip > PKZIP(R) Version 6.0 FAST! Compression Utility for Linux X86 > Copyright 1989-2002 PKWARE Inc. All Rights Reserved. Evaluation Version > PKZIP Reg. U.S. Pat. and Tm. Off. Patent No. 5,051,745 > > Extracting files from .ZIP: test2.zip > Errors were found in .ZIP file, attempt to fix (<Y>es/<N>o)? N > > PKZIP: (Z152) No CE signature found > > Help is much appreacited. > > Thanks in advance to all. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > !DSPAM:410c3369274921203516279! > > -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php