This is a translated page. The original can be found here: http://iwebdevel.com/2009/06/16/php-get-all-files-and-folders-from-a-directory-folder/
UPDATES VIA RSS | Email Updates via RSS | Email Get updates via feedburner Get updates via twitter
Home / Coding / PHP / PHP: Get all files and folde… Home / Coding / PHP / PHP: Merrni të gjitha dosjet dhe folde ...

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 Dragoskodim, 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);
} ) 
Translate this post Translate this post


Related posts: Related posts:

  1. 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
  2. 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?
  3. JavaScript: Where do I Find All Properties for All HTML Elements ? Java: Ku mund ta Find All Prona të gjitha elementet HTML?
  4. 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
  5. 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

    blog comments powered by Disqus Komentet blog powered by Disqus