Batch rename vbs

Source: Internet
Author: User

 

Code
1 Rem reads configuration files
2 Dim config
3 Config =   " Conf.txt "
4 Set FSO = Createobject ( " Scripting. FileSystemObject " )
5 Set A = Createobject ( " Scripting. Dictionary " )
6 Set File = FSO. opentextfile (config)
7 Do   While File. atendofstream <> True
8 M = M + 1
9 A. Add M, file. Readline
10 SRC = A (M)
11 Renamesubpage SRC
12 Loop
13 File. Close
14 Set FSO = Nothing
15 Msgbox " Operation completed " , 4096 , " File rename "
16
17 Sub renamesubpage (strurl)
18 Dim path
19 For I = 19 To 100
20 Path = Replace (strurl, " . Html " , " _ " & I &   " . Html " )
21 If FSO. fileexists (PATH) = True then
22 Target = Path &   " . Tmp "
23 FSO. movefile path, Target
24 Else
25 ' Do nothing
26 End if
27 Next
28 End sub
29

Note: The content of the conf.txt file is as follows:
D: \ A \ B \ c.html
D: \ D \ e \ f.html

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.