Folder (including subfolders and files), take the paths and file names of all files suffixed with JPG under the folder and subfolders, and put the paths and file names in the array

Source: Internet
Author: User
Tags glob
Folder (including subfolders and files), take the path and file name of all files suffixed with JPG under the folder and subfolders, and put the path and file name in the array to calculate how many files
The FOR loop is smaller than the total number of files.
Take the file name and path in sequence. Put arr in a two-dimensional array [0] [0] put the file name arr [0 [1] put the path
Loop ends


Reply to discussion (solution)

$ Path [] = 'images'; for ($ I = 0; $ I
  
  

Path: D: \ tupian. Where does the program add this path?


Take the JPG file under D: \ tupian, and the JPG file in all subdirectories of D: \ tupian.

$ Path [] = 'd: \ tupian ';

How did you learn programming? What's the opposite?

"Dirname ($ v)", can this location be replaced by an absolute path with a file name?

I don't know what you're talking about.


$ Res [] = array (dirname ($ v), basename ($ v ));

In this sentence, dirname ($ v) can be changed to a path containing a file name,

Path containing the file name, for example, d:/mulu/1.jpg.

Do you know $ v?

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.