PHP: Get all files and folders from a directory (folder) PHP: Gauti visus failus ir aplankus iš katalogo (aplanko)
Posted on 16. Posted on 16. Jun, 2009 by Dragos in Coding , PHP Birželis, 2009 Dragos ir kodavimo, PHP,
To get all files and folders from a directory (folder) I found scandir to be the perfect solution. Gauti visus failus ir aplankus iš katalogo (aplanko) Radau scandir būti puikus sprendimas.
scandir scans a directory and returns an array containing all files and directories under the parent directory we're looking in. scandir skenuoja kataloge ir grąžina masyvas kuriame visus failus ir katalogus pagal pagrindinį katalogą Mes ieškome in
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. Code bandys pašalinti katalogą, jei elementas yra kataloge arba ištrinti failo, jei atitinkamai elemento failą.
$lookin='./home/folder'; $ lookin = '. / home / aplankas "; $elements=scandir($lookin); $ elementai = scandir ($ lookin); foreach($elements as $singleEl) { foreach ($ elementai as $ singleEl) ( if(is_dir($lookin.'/'.$singleEl)) rmdir($lookin.'/'.$singleEl); if (is_dir ($ lookin .'/'.$ singleEl)) rmdir ($ lookin .'/'.$ singleEl); else kitas unlink($lookin.'/'.$singleEl); Unlink ($ lookin .'/'.$ singleEl); } )
Related posts: Related posts:
- Apache & ModRewrite: How to easily deny access to a folder with htaccess Apache & MODREWRITE: Kaip lengvai neleisti susipažinti su aplanko su htaccess
- JavaScript: How to get the index (position within a group) of an object with jQuery? JavaScript: Kaip gauti indeksą (pozicijos grupės) su jQuery objektas?
- JavaScript: Where do I Find All Properties for All HTML Elements ? JavaScript: Kur rasti Visi Ypatybės Visi HTML elementai?
- PHP: How to get creation time of file with PHP on Linux machines PHP: Kaip sukurti laiko Bylos su PHP Linux mašinos
- Wordpress: Best SEO iTranslator for Wordpress, get free traffic from fully automated plugin script WordPress: Geriausios SEO iTranslator wordpress, gauti nemokamą srautą visiškai automatizuota įjungti scenarijų












































