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: Kumuha ng lahat ng mga file at folde ...

PHP: Get all files and folders from a directory (folder) PHP: Kumuha ng lahat ng mga file at mga folder ng mula sa isang direktoryo (folder)

Posted on 16. Posted on 16. Jun, 2009 by Dragos in Coding , PHP Hunyo, 2009 sa pamamagitan ng Dragos sa Coding, PHP

To get all files and folders from a directory (folder) I found scandir to be the perfect solution. Upang makakuha ng lahat ng mga file at mga folder ng mula sa isang direktoryo (folder) ko natagpuan scandir upang maging perpektong solusyon.

scandir scans a directory and returns an array containing all files and directories under the parent directory we're looking in. scandir Sinusuri ng isang direktoryo at nagbalik sa isang array na naglalaman ng lahat ng mga file at direktoryo sa ilalim ng direktoryo ng magulang namin hinahanap ka

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. Ang code sa ibaba ay subukan na tanggalin ang isang directory, kung ang mga elemento ay isang direktoryo o tanggalin ang isang file, kung ayon sa pagkakabanggit ang mga sangkap ay isang file.

 $lookin='./home/folder'; $ = lookin '. / tahanan / folder';
$elements=scandir($lookin); mga sangkap ng $ = scandir ($ lookin);
foreach($elements as $singleEl) { foreach ($ elemento bilang $ singleEl) (
     if(is_dir($lookin.'/'.$singleEl)) rmdir($lookin.'/'.$singleEl); kung (is_dir ($ lookin .'/'.$ singleEl)) rmdir ($ lookin .'/'.$ singleEl);
     else kung hindi
     unlink($lookin.'/'.$singleEl); unlink ($ lookin .'/'.$ singleEl);
} ) 
Translate this post Isalin ang post na ito


Related posts: Related posts:

  1. Apache & ModRewrite: How to easily deny access to a folder with htaccess Apache & ModRewrite: Paano upang madaling tanggihan ng access sa isang folder na may htaccess
  2. JavaScript: How to get the index (position within a group) of an object with jQuery? JavaScript: Paano upang makuha ang index (na posisyon sa loob ng isang grupo) ng isang bagay na may jQuery?
  3. JavaScript: Where do I Find All Properties for All HTML Elements ? JavaScript: Saan ko Maghanap Lahat ng mga Katangian para sa Lahat ng Mga Sangkap ng HTML?
  4. PHP: How to get creation time of file with PHP on Linux machines PHP: Paano upang makakuha ng paglikha ng oras ng file na may PHP sa Linux machine
  5. Wordpress: Best SEO iTranslator for Wordpress, get free traffic from fully automated plugin script Wordpress: Pinakamagandang SEO iTranslator para sa Wordpress, makakakuha ng libreng trapiko mula sa lubos na automated na plugin script

    blog comments powered by Disqus blog comments powered by Disqus