Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php get list of filenames in diretory


<?php
// $dir is dir you want to return names of files and folders (first level - not recursive)
$dir    = '/tmp'; // './' for the root for the file calling scandir
$files1 = scandir($dir); // assending list
$files2 = scandir($dir, 1); //desending list 

print_r($files1);
print_r($files2); //frist files then folders alphabetically respective of types

//output $files1 order of folders then files alphabetically respective of types
//Array
// (
//    [0] => .
//    [1] => ..
//    [2] => folder1
//    [3] => folder2
//    [4] => folder3
//    [2] => file1
//    [2] => file2
//    [2] => file3
// )

?>

Comment

php list all files in directory

scandir ( string $directory [, int $sorting_order = SCANDIR_SORT_ASCENDING [, resource $context ]] ) : array
Comment

PREVIOUS NEXT
Code Example
Php :: how to stop laravel server 
Php :: laravel validation array input 
Php :: string to decimal php 
Php :: how to sent request in php 
Php :: php sum of digits 
Php :: clone array php 
Php :: apiresource laravel 
Php :: laravel hasmany 
Php :: Remove the Breadcrumbs on the Shop Entirely 
Php :: php collection to array 
Php :: laravel web php request to redirect to another page 
Php :: laravel wherenotin 
Php :: laravel form request validation unique update 
Php :: parse data from xml CDATA php 
Php :: install logger bundle in symfony project 
Php :: codeigniter abort 404 
Php :: laravel module make migration 
Php :: php return function result to variable 
Php :: php shorten string with dots 
Php :: php artisan create controller inside folder 
Php :: check if string contains only whitespace php 
Php :: php fetch mysql result as variable 
Php :: submonth carbon 
Php :: General error: 1390 Prepared statement contains too many placeholders 
Php :: if condition in php 
Php :: how to create shortcode with php 
Php :: Catches the last error php 
Php :: print in php 
Php :: if url has certain code then php 
Php :: import local js file laravel 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =