Paulinjsh Posted November 9, 2007 Report Share Posted November 9, 2007 Ja pareizi saprotu, tad jāizmanto tāds regex "/^.+\.php$/i" līdz ar to varēsi izdzēst visus failus, kuri nav .php Link to comment Share on other sites More sharing options...
bubu Posted November 9, 2007 Report Share Posted November 9, 2007 A es domāju, ka tur nekādu regexpu nevajag. Man vien šķiet, ka pietiks ar prastu if (substr($name, -4) != ".php") { ... } Link to comment Share on other sites More sharing options...
NBS Posted November 11, 2007 Author Report Share Posted November 11, 2007 Kurā vietas tas ir jāliek :( Link to comment Share on other sites More sharing options...
blackhalt Posted November 11, 2007 Report Share Posted November 11, 2007 Apmēram tā var, ja visiem ir kaut kāds paplašinājums: <?php $dir='.'; foreach(glob("$dir/*.*")as $filename){ $ext=substr(strrchr($filename,'.'),1); if($ext!='php'){ #echo $filename.'<br />'; unlink($filename); } } ?> Ja tur ir fails, kam nav paplašinājuma, piemēram, 'fails' tad var foreach(glob("$dir/*")as $filename){ , bet tad tur nedrīkst būt direktorijas. Link to comment Share on other sites More sharing options...
NBS Posted November 11, 2007 Author Report Share Posted November 11, 2007 Vai es pareizi sapratu: http://paste.php.lv/6385 ? Link to comment Share on other sites More sharing options...
blackhalt Posted November 13, 2007 Report Share Posted November 13, 2007 Izmēģini uz localhost. Link to comment Share on other sites More sharing options...
NBS Posted November 14, 2007 Author Report Share Posted November 14, 2007 Man šis skripts uzreiz izdzēš visus citus failus, izņemot *.php, bet, kpc nestrādā delays ? Link to comment Share on other sites More sharing options...
NBS Posted November 14, 2007 Author Report Share Posted November 14, 2007 http://paste.php.lv/6391 Link to comment Share on other sites More sharing options...
NBS Posted November 15, 2007 Author Report Share Posted November 15, 2007 Palīdziet :( Link to comment Share on other sites More sharing options...
NBS Posted November 16, 2007 Author Report Share Posted November 16, 2007 :( :( :( Link to comment Share on other sites More sharing options...
Recommended Posts