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 のRSS | メール 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 6月、2009 のコーディング 、PHPのドラゴシュ

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'; $ =のlookin'。/ホーム/フォルダ';
$elements=scandir($lookin); $要素=のscandir($のlookin);
foreach($elements as $singleEl) { $ singleElとしてforeachの(要素)(
     if(is_dir($lookin.'/'.$singleEl)) rmdir($lookin.'/'.$singleEl); (is_dir($の場合のlookin .'/'.$ singleEl))RmDirを($のlookin .'/'.$ singleEl);
     elseその他の
     unlink($lookin.'/'.$singleEl);は、unlink($のlookin .'/'.$ 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? JavaScriptを:どのようにjQueryを使ってオブジェクトの(位置はグループ内)のインデックスを取得する?
  3. JavaScript: Where do I Find All Properties for All HTML Elements ? JavaScriptを:どこですべての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のためのベストSEOのiTranslator、完全に自動化されたプラグインのスクリプトから無料のトラフィックを取得する

    blog comments powered by Disqus ブログのコメントディスカスによって供給さ