The specified path is known for the file count problem. the folder under this path is the number of OK records. However, the size of each folder is limited to 100 files, and the naming rules of the folder are, and so on. How can I calculate the total number of OK files in this path?
Reply to discussion (solution)
Traverse folders (scandir) to get the number of files in the folder
$ A = glob ('specify the path/{0, 1, 2, 3, 4, 5, 6, 8, 9} */*. * ', GLOB_BRACE); echo count ($ );
$ A = glob ('specify the path/{0, 1, 2, 3, 4, 5, 6, 8, 9} */*. * ', GLOB_BRACE); echo count ($ );
The result is incorrect:
TS404> MEC91-172B1> 2825 0 --- 0
TS404> MEC91-172B1> 2827 0 --- 0
TS404> MEC91-172B1> 2828 0 --- 0
TS404> MEC91-172B1> 2901 0 --- 0
TS404> MEC91-172B1> 2903 0 --- 0
TS404> MEC91-172B1> 2904 0 --- 0
TS404> MEC91-172B1> 2906 0 --- 0
TS404> MEC91-172B1> 2907 0 --- 0
TS404> MEC91-172B1> 2909 0 --- 0
TS404> MEC91-172B1> 2910 0 --- 1
TS404> MEC91-172B1> 2914 0 --- 0
TS404> MEC91-172B1> 2915 0 --- 2
TS404> MEC91-172B1> 2917 0 --- 0
TS404> MEC91-172B1> 2921 0 --- 0
TS404> MEC91-172B1> 2X19 0 --- 0
TS404> MEC91-172B1> 2X23 0 --- 0
TS404> MEC91-172B1> 2X26 0 --- 0
TS404> MEC91-172B1> 2X29 0 --- 0
TS404> MEC91-172B1> 2X30 0 --- 0
TS404> MEC91-172B1> 2Y02 0 --- 1
--- The preceding values are all 0.
$ A = glob ('specify the path/{0, 1, 2, 3, 4, 5, 6, 8, 9} */*. * ', GLOB_BRACE); echo count ($ );
File structure:
Assume that your program file is at the same level as the dat Directory
$path = 'dat/*/*/3X*/{0,1,2,3,4,5,6,7,8,9}*/*.*';$a = glob($path, GLOB_BRACE);echo count($a);
You can print the result array $.
Assume that your program file is at the same level as the dat Directory
$path = 'dat/*/*/3X*/{0,1,2,3,4,5,6,7,8,9}*/*.*';$a = glob($path, GLOB_BRACE);echo count($a);
You can print the result array $.
What if ftp is used for access?
Assume that your program file is at the same level as the dat Directory
$path = 'dat/*/*/3X*/{0,1,2,3,4,5,6,7,8,9}*/*.*';$a = glob($path, GLOB_BRACE);echo count($a);
You can print the result array $.
Local access is indeed acceptable. what if it is in the form of \ 192.168 \ e \ dat? How to access it? Can I change to ftp?
Must I use php?
It is easy to use the linunx command.
Find folder-type f | wc-l
Assume that your program file is at the same level as the dat Directory
$path = 'dat/*/*/3X*/{0,1,2,3,4,5,6,7,8,9}*/*.*';$a = glob($path, GLOB_BRACE);echo count($a);
You can print the result array $.
Local access is indeed acceptable. what if it is in the form of \ 192.168 \ e \ dat? How to access it? Can I change to ftp?
You need to connect to ftp before executing glob