Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php get all txt files in directory

$path = '/path/to/directory';
$files = glob($path."/*.txt");
foreach ($files as $file) {
  echo $file;
  echo '<br>';
}
/* Outputs something like: 
	/path/to/directory/someFile.txt
	/path/to/directory/someOtherFile.txt
	/path/to/directory/anotherFile.txt
*/
 
PREVIOUS NEXT
Tagged: #php #txt #files #directory
ADD COMMENT
Topic
Name
5+1 =