File count Issues

Source: Internet
Author: User
Tags glob ftp access
The specified path is known, and the folder under that path is the number of record OK. However, the capacity limit for each folder is 100 files, the naming rules for folders are 0000,0001,0002,0003, and so on. What should I do if I want to count the total number of OK files under this path?


Reply to discussion (solution)

Traverse folder (Scandir) to get the number of files under a folder



The result is not right:

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 front, it's all 0.


File structure:

Assuming that your program files are at the same peer as the DAT directory, there are

$path = ' dat/*/*/3x*/{0,1,2,3,4,5,6,7,8,9}*/*.* '; $a = Glob ($path, glob_brace); Echo count ($a);

You can print out an array of results $a look at


Assuming that your program files are at the same peer as the DAT directory, there are

$path = ' dat/*/*/3x*/{0,1,2,3,4,5,6,7,8,9}*/*.* '; $a = Glob ($path, glob_brace); Echo count ($a);

You can print out an array of results $a look at


What if I access it via FTP?

Assuming that your program files are at the same peer as the DAT directory, there are

$path = ' dat/*/*/3x*/{0,1,2,3,4,5,6,7,8,9}*/*.* '; $a = Glob ($path, glob_brace); Echo count ($a);

You can print out an array of results $a look at



Local access really can, if like \\192.168\e\dat this form? How to access? Can I switch to FTP access?

Must you use PHP?
If you use the Linunx command, it is simple.

Find folder-type F |wc-l


Assuming that your program files are at the same peer as the DAT directory, there are

$path = ' dat/*/*/3x*/{0,1,2,3,4,5,6,7,8,9}*/*.* '; $a = Glob ($path, glob_brace); Echo count ($a);

You can print out an array of results $a look at



Local access really can, if like \\192.168\e\dat this form? How to access? Can I switch to FTP access?



You need to connect the FTP first and then execute the Glob
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.