PHP: Get all files and folders from a directory (folder) PHP: Get vse datoteke in mape iz imenika (mape)
Posted on 16. Objavljeno dne 16. Jun, 2009 by Dragos in Coding , PHP Junij 2009, ki ga Dragos v Coding, PHP
To get all files and folders from a directory (folder) I found scandir to be the perfect solution. Če želite dobiti vse datoteke in mape iz imenika (mape) sem našel scandir biti popolna rešitev.
scandir scans a directory and returns an array containing all files and directories under the parent directory we're looking in. scandir skandiranje imeniku in vrne niz, ki vsebuje vse datoteke in imenike v okviru matičnega imenik smo videti noter
The code below will try to remove a directory, if the element is a directory or delete a file, if respectively the element is a file. Zbornik spodaj bo poskušal odstraniti imenika, če je element imenik ali izbrišete datoteko, če je element oziroma datoteke.
$lookin='./home/folder'; $ gledaš = '. / home / mapa'; $elements=scandir($lookin); $ elementi = scandir ($ videti); foreach($elements as $singleEl) { foreach ($ $ elemente, kot so singleEl) ( if(is_dir($lookin.'/'.$singleEl)) rmdir($lookin.'/'.$singleEl); if (is_dir ($ videti .'/'.$ singleEl)) rmdir ($ videti .'/'.$ singleEl); else še unlink($lookin.'/'.$singleEl); odvezati ($ videti .'/'.$ singleEl); } )
Related posts: Podobni objav:
- Apache & ModRewrite: How to easily deny access to a folder with htaccess Apache & ModRewrite: Kako se lahko zavrne dostop do mape z htaccess
- JavaScript: How to get the index (position within a group) of an object with jQuery? JavaScript: Kako indeks (položaj v skupini) predmeta s jQuery?
- JavaScript: Where do I Find All Properties for All HTML Elements ? JavaScript: Kam Najdi vse lastnosti za vse elemente HTML?
- PHP: How to get creation time of file with PHP on Linux machines PHP: Kako ustvarjanje časa datoteke s PHP na računalnikih Linux
- Wordpress: Best SEO iTranslator for Wordpress, get free traffic from fully automated plugin script Wordpress: Best SEO iTranslator za Wordpress, zaslužiti prost promet iz povsem avtomatiziran plugin script












































