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 अद्यतन Via आरएसएस | ईमेल Get updates via feedburner Get updates via twitter
Home / Coding / PHP / PHP: Get all files and folde… घर / कोडिंग / PHP / PHP: सभी फ़ाइलें और folde प्राप्त करें ...

PHP: Get all files and folders from a directory (folder) PHP: सभी फ़ाइलें और एक निर्देशिका फ़ोल्डर (फ़ोल्डर से प्राप्त)

Posted on 16. 16 पर तैनात हैं. Jun, 2009 by Dragos in Coding , PHP जून, 2009 कोडिंग, PHP में Dragos द्वारा

To get all files and folders from a directory (folder) I found scandir to be the perfect solution. सभी फ़ाइलें और निर्देशिका (फ़ोल्डर) मैं सही समाधान हो scandir पाया से फ़ोल्डर्स मिलता है.

scandir scans a directory and returns an array containing all files and directories under the parent directory we're looking in. scandir एक निर्देशिका स्कैन और एक माता पिता की निर्देशिका के अंतर्गत सभी फाइल और निर्देशिका जिसमें हम देख रहे हैं अंदर सरणी रिटर्न

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. नीचे दिये कोड को एक निर्देशिका को दूर करने की कोशिश, अगर तत्व एक निर्देशिका या एक फ़ाइल को नष्ट, अगर क्रमशः तत्व है एक फ़ाइल है.

 $lookin='./home/folder'; = देख $ '. / घर / फ़ोल्डर';
$elements=scandir($lookin); $ तत्वों = scandir (देख $);
foreach($elements as $singleEl) { foreach singleEl के रूप में $ $ (तत्वों) (
     if(is_dir($lookin.'/'.$singleEl)) rmdir($lookin.'/'.$singleEl); is_dir (($ अगर देख .'/'.$) rmdir) singleEl ($ देख singleEl .'/'.$);
     else अन्यथा
     unlink($lookin.'/'.$singleEl); उतारना ($ देख singleEl .'/'.$);
} ) 
Translate this post अनुवाद इस पोस्ट


Related posts: संबंधित पोस्ट:

  1. Apache & ModRewrite: How to easily deny access to a folder with htaccess Apache और ModRewrite: कैसे आसानी से एक फ़ोल्डर का उपयोग करने से इनकार करने htaccess
  2. JavaScript: How to get the index (position within a group) of an object with jQuery? : जावास्क्रिप्ट कैसे सूचकांक प्राप्त करने की स्थिति एक समूह के भीतर (jQuery के साथ एक वस्तु का)?
  3. JavaScript: Where do I Find All Properties for All HTML Elements ? जावास्क्रिप्ट: कहाँ मैं सभी HTML तत्वों के लिए सभी गुण मिला?
  4. PHP: How to get creation time of file with PHP on Linux machines : PHP कैसे Linux मशीन पर PHP के साथ फाइल का सृजन बार पाने के लिए
  5. Wordpress: Best SEO iTranslator for Wordpress, get free traffic from fully automated plugin script WordPress: WordPress के लिए सर्वश्रेष्ठ एसईओ iTranslator, पूरी तरह से स्वचालित प्लगइन स्क्रिप्ट से मुक्त आवागमन प्राप्त

    blog comments powered by Disqus ब्लॉग टिप्पणियों Disqus द्वारा संचालित