ASP reads the file name under the specified directory

Source: Internet
Author: User

InStrRev ("Abcd.jpg", ".") calculates the first occurrence in the abcd.jpg. The location is the number of characters =5

Mid ("Abcd.jpg", 1,4) takes the top four ABCD

Mid ("Abcd.jpg", 5) is taken from five bits (including fifth digit). jpg

Take the prefix ABC

FullPath = "Abc.jpg"
F = Mid (Fullpath,1,instrrev (FullPath, ".") -1)
Response.Write F

Marry suffix jpg

FullPath = "Abc.jpg"
F = Mid (Fullpath,instrrev (FullPath, ".") +1)
Response.Write F

<%
Set myfileobject=server.createobject ("Scripting.FileSystemObject") ' Creates a Folder object
Foldername=server.mappath ("./")
Set Myfolder=myfileobject.getfolder (foldername)
I=0 ' Cycle display of folders
Response.Write "Show Folders:"
For each thing in Myfolder.subfolders
Response.Write ("<br>" &thing)
I=i+1
Next
Response.Write "<br> Total" &i& "Folders"
Response.Write "<p> Show file name" ' Loop to display the files
I=0
For each thing in Myfolder.files
Response.Write ("<br>" &thing)
I=i+1
Next
Response.Write "<br> Total" &i& "files"
%>

ASP reads the file name under the specified directory

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.