Using ASP to implement the code of renaming files in bulk
Source: Internet
Author: User
<% @LANGUAGE = VBSCRIPT%>
<%option explicit%>
<%
' Rename the file name in the folder and move all the files to the new folder in the following batch;
Response.Write "Response.Write "<title> Batch file Rename </title>" & VbCrLf
Response.Write "' Variable description
Dim gbolgoprocedure
Dim Strfromdir ' source folder
Dim Strtargetdir ' destination folder
Dim OBJFS
Dim Objrootfolder
Dim objfile
Dim Strfilenamelen
Dim Strprevfilename
Dim strfileext ' file name extension
Dim Strfilenamecount
Dim Strnewfilename
Dim strrealcount ' Number of files processed
Gbolgoprocedure = False
' If you click on the Start button, do the following
If (Request.Form ("Gobutton")) = "Start" Then
' Specify source folder, destination folder
Strfromdir = "D:test\"
Strtargetdir = "D:\test1\"
' Set the number of processed files to 0
Strrealcount = 0
Set OBJFS = Server.CreateObject ("Scripting.FileSystemObject")
Set Objrootfolder = Objfs.getfolder (Strtargetdir)
' The filename is set to 100001, indicating that the filename will be from 100001
' Start, gradually increase, can be set according to need;
Strfilenamecount = 100001
For each objfile in Objrootfolder.files
' For specific files, no processing, can be set according to need;
If objfile.name = "Thumbs.db" Then Strfilenamecount = StrFileNameCount-1
Strfilenamecount = Strfilenamecount + 1
Next
Set Objrootfolder = Objfs.getfolder (Strfromdir)
For each objfile in Objrootfolder.files
Strfilenamelen = Len (objfile.name)
If Mid (Objfile.name, (strFileNameLen-3), 1) = "." Then
Strfileext = Right (Objfile.name, 4)
Else
Strfileext = Right (Objfile.name, 5)
End If
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