'Php gunzip and get name

Good morning!

I unzipped the archive using php, but after that I need to get the name of the files and perform another action, but I can not figure out how to do it.

Is it possible to do this with php? If so, tell me how and, if possible, an example, even a light one.

Thanks

$filelist = glob("/emp/*.gz");

$filedirtxt = glob("/emp/*.txt");


foreach ($filelist as $key => $value) {
    
    $filename = pathinfo($value);

    $gzname = $filename['basename'];

    $gunzip = shell_exec("gunzip "."/emp/".$gzname);

foreach ($filedirtxt as $keytxt => $valuetxt) {
        
        $filename_txt = pathinfo($valuetxt);

        $name_txt = $filename_txt['basename'];

        echo $name_txt."\n";

    }
    
}
php


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source