Arrange array of paths:
$paths = array(
"C:\test1\file1.txt",
"C:\test1\file2.txt",
"C:\test2\test1\file15.txt",
"C:\test1\file4.txt"
);
PHP code return data - If possible as array multi-dimension :
You have 2 folders [count array of folders]
In folder 1 you have 3 files [count array of files]
In folder 2 you have 1 files [count array of files]
[C:\test1\] => file1.txt,file2.txt,file4.txt
[C:\test2\test1\] => file15.txt