Code implementation using asp batch modification program, fso related
It is a small thing that needs to be done in batches of code modifications, and I will share it with you.
The file types that can be processed at present: .asp .inc .htm .html The specific types can be modified and added by yourself.
Functions implemented by the program: batch modify the files in the source directory and save them to the destination directory.
A few modifications can achieve many things!
I won't say anything else, the code is very clear
<%
'// +---------------------------------------------------------------------------+
'// | Program name: Stone Code Batch Modifier v1.01 |
'// | All rights reserved by the stones of the other mountains, infringement will be pursued! Please indicate the copyright when reprinting:) |
'// | ------------------------------------------------------------------------- |
'// | System: win2000; Editor: EditPlus; Indentation tool: Tab; Indentation length: 8; Font: Songti (10pt); |
'// | ------------------------------------------------------------------------- |
'// | Creator: WYC; Creation time: 2004-03-08; |
'// | Writer: WYC; Write time: 2004-03-08; |
'// +---------------------------------------------------------------------------+
= 500 'Script timeout
'// +---------------------------------------------------------------------------+
'// | Batch Modify Functions |
'// | ------------------------------------------------------------------------- |
'// | Attribute: path_from source file directory path_to target file working directory |
'// | ------------------------------------------------------------------------- |
'// | Return value: None |
'// | ------------------------------------------------------------------------- |
'// | Program flow:... |
'// | ------------------------------------------------------------------------- |
'// | Writer: WYC; Write time: 2004-03-08; |
'// +---------------------------------------------------------------------------+
Sub midfile(path_from, path_to)
list_from = path_from 'Storage the current source working directory
list_to = path_to 'Storage the current target working directory
Set fso = CreateObject("")
Set Fold = (list_from) 'Get Folder object
Set fc = 'get file record set
Set mm = 'get the directory record set
For Each f2 in mm
set objfile = ("")
(path_to & "\" & ) 'Create directory
midfile path_from & "\" & , path_to & "\" & 'recursive call
path_to & "\" & & " Complete!<br>"
Next
For Each f1 in fc
file_from = list_from & "\" & 'generated file address (source)
file_to = list_to & "\" & 'Create file address (to)
fileExt = lcase(right(,4)) 'get file type
If fileExt=".asp" or fileExt=".inc" or fileExt=".htm" or fileExt="html" Then 'The specific type can be modified and added by yourself
set objfile = ("") 'Define a server component (read source file)
set out = (file_from, 1, false, false)
content = 'Read data
'// +---------------------------------------------------+
'// | File content processing module (mainly, others are file operations) |
Set regEx = New RegExp
= "(\>\s*\n)"
= true 'Set all matching modes
content = (content, ">") 'Replace the carriage return character
content = Replace(content, " ", "") 'For tab replacement
'// +---------------------------------------------------+
set objfile = ("") 'Define a server component (write to the target file)
set outt = (file_to,TRUE,FALSE)
(content) 'Write data
else ' Otherwise copy the file directly
Set fso = CreateObject("")
file_from, file_to
End If
Next
End Sub
midfile ("temp/aaa"), ("temp/bbb") 'Call example The source directory temp/aaa is processed and saved to temp/bbb
'Source Directory Destination Directory (must be an existing directory)
%>
It is a small thing that needs to be done in batches of code modifications, and I will share it with you.
The file types that can be processed at present: .asp .inc .htm .html The specific types can be modified and added by yourself.
Functions implemented by the program: batch modify the files in the source directory and save them to the destination directory.
A few modifications can achieve many things!
I won't say anything else, the code is very clear
<%
'// +---------------------------------------------------------------------------+
'// | Program name: Stone Code Batch Modifier v1.01 |
'// | All rights reserved by the stones of the other mountains, infringement will be pursued! Please indicate the copyright when reprinting:) |
'// | ------------------------------------------------------------------------- |
'// | System: win2000; Editor: EditPlus; Indentation tool: Tab; Indentation length: 8; Font: Songti (10pt); |
'// | ------------------------------------------------------------------------- |
'// | Creator: WYC; Creation time: 2004-03-08; |
'// | Writer: WYC; Write time: 2004-03-08; |
'// +---------------------------------------------------------------------------+
= 500 'Script timeout
'// +---------------------------------------------------------------------------+
'// | Batch Modify Functions |
'// | ------------------------------------------------------------------------- |
'// | Attribute: path_from source file directory path_to target file working directory |
'// | ------------------------------------------------------------------------- |
'// | Return value: None |
'// | ------------------------------------------------------------------------- |
'// | Program flow:... |
'// | ------------------------------------------------------------------------- |
'// | Writer: WYC; Write time: 2004-03-08; |
'// +---------------------------------------------------------------------------+
Sub midfile(path_from, path_to)
list_from = path_from 'Storage the current source working directory
list_to = path_to 'Storage the current target working directory
Set fso = CreateObject("")
Set Fold = (list_from) 'Get Folder object
Set fc = 'get file record set
Set mm = 'get the directory record set
For Each f2 in mm
set objfile = ("")
(path_to & "\" & ) 'Create directory
midfile path_from & "\" & , path_to & "\" & 'recursive call
path_to & "\" & & " Complete!<br>"
Next
For Each f1 in fc
file_from = list_from & "\" & 'generated file address (source)
file_to = list_to & "\" & 'Create file address (to)
fileExt = lcase(right(,4)) 'get file type
If fileExt=".asp" or fileExt=".inc" or fileExt=".htm" or fileExt="html" Then 'The specific type can be modified and added by yourself
set objfile = ("") 'Define a server component (read source file)
set out = (file_from, 1, false, false)
content = 'Read data
'// +---------------------------------------------------+
'// | File content processing module (mainly, others are file operations) |
Set regEx = New RegExp
= "(\>\s*\n)"
= true 'Set all matching modes
content = (content, ">") 'Replace the carriage return character
content = Replace(content, " ", "") 'For tab replacement
'// +---------------------------------------------------+
set objfile = ("") 'Define a server component (write to the target file)
set outt = (file_to,TRUE,FALSE)
(content) 'Write data
else ' Otherwise copy the file directly
Set fso = CreateObject("")
file_from, file_to
End If
Next
End Sub
midfile ("temp/aaa"), ("temp/bbb") 'Call example The source directory temp/aaa is processed and saved to temp/bbb
'Source Directory Destination Directory (must be an existing directory)
%>