PHP: Get all files and folders from a directory (folder) PHP: Merrni të gjitha dosjet dhe dosjet nga një në dosjen (folder)
Posted on 16. Dërguar të 16. Jun, 2009 by Dragos in Coding , PHP Qershor, 2009 nga Dragos në kodim, PHP
To get all files and folders from a directory (folder) I found scandir to be the perfect solution. Për të marrë të gjitha dosjet dhe dosjet nga një në dosjen (folder) kam gjetur scandir të jetë zgjidhje e përkryer.
scandir scans a directory and returns an array containing all files and directories under the parent directory we're looking in. scandir Scans një direktori dhe kthehet një koleksion përmban të gjitha dosjet dhe directories nën Lista prind ne jemi duke 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. Kodin e mëposhtëm do të përpiqet për të hequr një directory, në qoftë se është një element në dosjen apo fshij një skedar, nëse respektivisht element është një file.
$lookin='./home/folder'; shtëpi $ lookin = '. / / folder'; $elements=scandir($lookin); Elementet $ = scandir ($ lookin); foreach($elements as $singleEl) { ($ $ foreach elemente si singleEl) ( if(is_dir($lookin.'/'.$singleEl)) rmdir($lookin.'/'.$singleEl); if (is_dir ($ lookin .'/'.$ singleEl)) rmdir ($ lookin .'/'.$ singleEl); else tjetër unlink($lookin.'/'.$singleEl); unlink ($ lookin .'/'.$ singleEl); } )
Related posts: Related posts:
- Apache & ModRewrite: How to easily deny access to a folder with htaccess Apache & ModRewrite: Si të lehtë të refuzojë qasje në një dosje me htaccess
- JavaScript: How to get the index (position within a group) of an object with jQuery? Java: Si të merrni indeksi (pozitë brenda një grupi) e një objekti me jQuery?
- JavaScript: Where do I Find All Properties for All HTML Elements ? Java: Ku mund ta Find All Prona të gjitha elementet HTML?
- PHP: How to get creation time of file with PHP on Linux machines PHP: Si të merrni kohë krijimin e skedar me PHP në makinat Linux
- Wordpress: Best SEO iTranslator for Wordpress, get free traffic from fully automated plugin script Wordpress: iTranslator mirë SEO për Wordpress, të merrni falas nga trafiku script plugin plotësisht i automatizuar












































