NBS Posted November 9, 2007 Report Share Posted November 9, 2007 Man ir šāds skripts, kas pēc noteikta laika dzēš ārā failus. Tā kā, man šajā folderī atrodas .php faili tos arī izdzēš :( Vai kāds varētu pateikt, kā varētu izveidot tā, lai .php failus neaiztiktu ? Scripts: http://paste.php.lv/6375 Link to comment Share on other sites More sharing options...
Delfins Posted November 9, 2007 Report Share Posted November 9, 2007 (edited) pielabo pregu: (dem|php) Edited November 9, 2007 by Delfins Link to comment Share on other sites More sharing options...
NBS Posted November 9, 2007 Author Report Share Posted November 9, 2007 if (preg_match('/.*-([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})-.*/, *.php', $fname, $m) == false) ? Link to comment Share on other sites More sharing options...
Delfins Posted November 9, 2007 Report Share Posted November 9, 2007 Ups sory, sajaucu... viss tur ir pareizi... if (!preg_match() || $mtime > $rtime) { continue; } unlink(); īstenībā aizkomentē unlink() un vnk izdrukā, kas tur sanāk.. pārliecināties vai viss kārtībā Link to comment Share on other sites More sharing options...
NBS Posted November 9, 2007 Author Report Share Posted November 9, 2007 Man skripts strādā tikai es gribu, lai tas nedzēš ārā .php failus... Link to comment Share on other sites More sharing options...
andrisp Posted November 9, 2007 Report Share Posted November 9, 2007 Šis regexps: /^.+\.dem.*$/ Atbild arī šim: aasd.dem.dsd.php Kādi tev ir tie php failu nosaukumi ? Un izdari to ko Delfins teica, lai varētu padebugot. Link to comment Share on other sites More sharing options...
NBS Posted November 9, 2007 Author Report Share Posted November 9, 2007 Teikšu godīgi neiebraucu. Vispār .php failus kā ideju. Man dzēš visus pārējos failus, kas vecāki par 1 nedēļu, kas iemesti folderī. Tur arī atrodas index.php, kuru es negribu, lai viņš izdzēš. Link to comment Share on other sites More sharing options...
Delfins Posted November 9, 2007 Report Share Posted November 9, 2007 (edited) Jā un labāk šito: "/^.+\.dem$/i" Edited November 9, 2007 by Delfins Link to comment Share on other sites More sharing options...
NBS Posted November 9, 2007 Author Report Share Posted November 9, 2007 Reāli neiebraucu :( Link to comment Share on other sites More sharing options...
andrisp Posted November 9, 2007 Report Share Posted November 9, 2007 Regexpu nomaini! Un 10. līdz 18. rindiņas man šķiet vajag šādi: for ($rmtime = time() - $ttl; ($fname = readdir($dp)) !== false;) { $ffullname = $dir . '/' . $fname; if ((preg_match($pattern, $fname) == false) || ($getTimeFunc($ffullname) > $rmtime)) { continue; } unlink ($ffullname); } Link to comment Share on other sites More sharing options...
NBS Posted November 9, 2007 Author Report Share Posted November 9, 2007 Notestēšu. Link to comment Share on other sites More sharing options...
NBS Posted November 9, 2007 Author Report Share Posted November 9, 2007 Nestrādā :( Link to comment Share on other sites More sharing options...
andrisp Posted November 9, 2007 Report Share Posted November 9, 2007 Ko nozīmē nestrādā ? Pastāti sīkāk, kas notiek ? Kādi kļūdas paziņojumi ? Dzēš visu vai nedzēš neko ? Link to comment Share on other sites More sharing options...
NBS Posted November 9, 2007 Author Report Share Posted November 9, 2007 Nedzēšs neko un kļūdu arī nekādu nemet... Link to comment Share on other sites More sharing options...
Delfins Posted November 9, 2007 Report Share Posted November 9, 2007 ieliec echo() un paskaties kas tur sanāk Link to comment Share on other sites More sharing options...
Recommended Posts