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 Posodobitev prek RSS | Email Get updates via feedburner Get updates via twitter
Home / Coding / PHP / PHP: Get all files and folde… Domov / Coding / PHP / PHP: Get vse datoteke in folde ...

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); 
 } ) 
Translate this post Prevedi to post


Related posts: Podobni objav:

  1. Apache & ModRewrite: How to easily deny access to a folder with htaccess Apache & ModRewrite: Kako se lahko zavrne dostop do mape z htaccess
  2. 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?
  3. JavaScript: Where do I Find All Properties for All HTML Elements ? JavaScript: Kam Najdi vse lastnosti za vse elemente HTML?
  4. PHP: How to get creation time of file with PHP on Linux machines PHP: Kako ustvarjanje časa datoteke s PHP na računalnikih Linux
  5. 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

    blog comments powered by Disqus blog comments powered by Disqus