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 AĠĠORNAMENTI VIA RSS | Email Get updates via feedburner Get updates via twitter
Home / Coding / PHP / PHP: Get all files and folde… Home / Kodifika / PHP / PHP: Niżżel l-fajls kollha u folde ...

PHP: Get all files and folders from a directory (folder) PHP: Get kollha fajls u folders minn direttorju (folder)

Posted on 16. Posted on 16. Jun, 2009 by Dragos in Coding , PHP Ġunju, 2009 minn Dragos fl-Kodifika, PHP

To get all files and folders from a directory (folder) I found scandir to be the perfect solution. Biex tikseb l-fajls u folders minn direttorju (folder) I scandir misjuba li tkun is-soluzzjoni perfetta.

scandir scans a directory and returns an array containing all files and directories under the parent directory we're looking in. scandir scans f'direttorju u jirritorna l-firxa li fiha l-fajls kollha u direttorji taħt il-direttorju parent we're tfittex pulzieri

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. Il-kodiċi hawn taħt ser tipprova tneħħi direttorju, jekk l-element huwa direttorju jew iħassar il-fajl, rispettivament jekk l-element huwa fajl.

 $lookin='./home/folder'; dar $ lookin = ". / / folder";
$elements=scandir($lookin); elementi $ = scandir ($ lookin);
foreach($elements as $singleEl) { ($ elementi foreach bħala $ singleEl) (
     if(is_dir($lookin.'/'.$singleEl)) rmdir($lookin.'/'.$singleEl); jekk (is_dir ($ lookin .'/'.$ singleEl)) rmdir ($ lookin .'/'.$ singleEl);
     else ieħor
     unlink($lookin.'/'.$singleEl); unlink ($ lookin .'/'.$ singleEl);
} ) 
Translate this post Ittraduċi din il-kariga


Related posts: Related postijiet:

  1. Apache & ModRewrite: How to easily deny access to a folder with htaccess Apache & ModRewrite: Kif faċilment jiċħad l-aċċess għal folder ma htaccess
  2. JavaScript: How to get the index (position within a group) of an object with jQuery? JavaScript: Kif tista 'tikseb l-indiċi (il-pożizzjoni fi ħdan grupp) ta' oġġett jQuery?
  3. JavaScript: Where do I Find All Properties for All HTML Elements ? JavaScript: Fejn nista Find All Properties for All Elementi HTML?
  4. PHP: How to get creation time of file with PHP on Linux machines PHP: Kif tikseb ħin ħolqien tal-fajl ma PHP fuq magni Linux
  5. Wordpress: Best SEO iTranslator for Wordpress, get free traffic from fully automated plugin script Wordpress: Best SEO iTranslator għall Wordpress, ġib it-traffiku ħieles mill-iskrittura plugin totalment awtomatizzati

    blog comments powered by Disqus blog kummenti powered by Disqus