CodeIgniter Forums
small mistake about 'get_dir_file_info' - Printable Version

+- CodeIgniter Forums (
+-- Forum: Development (
+--- Forum: Issues (
+--- Thread: small mistake about 'get_dir_file_info' (/thread-65527.html)

small mistake about 'get_dir_file_info' - Bernard59 - 06-22-2016

I do not know if the problem has already been informed, but just in case, let me point out what appears to be an error.
the "File_Helper" said about 'get_dir_file_info':

Quote:Reads the specified directory and builds an array Containing the filenames, filesize, dates, and permissions. Sub-folders contained dans le specified path are only read if forced by sending the second parameter to FALSE, as this can be an intensive operation.

So, this should give all the files in all sub-folders ....

But, as the result is an array whose first key is the name of the file ($file), if files with the same name ($file) are contained in several sub-folders, the final array will contain only that proceedings to file ($file): the last found by the script.

Therefore, if we want to use this script (get_dir_file_info) to resolve all files contained in a folder and subfolders, it is necessary to use a file name only once time, and/ or rename each file with indexing its name, for example by incrementing (file1.ext, file2.ext ...)

RE: small mistake about 'get_dir_file_info' - Bernard59 - 06-22-2016

For example:
if 'test.txt' is contained in '\public' and his sub folder '\public\uploads', the result is only:
[Test.txt] => Array
[Name] => test.txt
[Server_path] => ......\public_\uploads\test.txt

and will not be counted twice (once in '\public' and two again in '\public\uploads')

RE: small mistake about 'get_dir_file_info' - Narf - 06-22-2016

It's not an error; it's a badly-designed legacy feature.

RE: small mistake about 'get_dir_file_info' - Bernard59 - 06-22-2016

OK thank you for your answer