<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="Keywords" content="">
<meta HTTP-EQUIV="Reply-to" content="kicker0609@163.com">
<meta HTTP-EQUIV="Expires" CONTENT="0">
<TITLE></TITLE>
</HEAD>
<BODY>
<%
' 变量说明
Dim gbolGoProcedure
Dim strFromDir '源文件夹
Dim strTargetDir '目标文件夹
Dim objFS
Dim objRootFolder
Dim objFile
Dim strFileNameLen
Dim strPrevFileName
Dim strFileExt '文件扩展名
Dim strFileNameCount
Dim strNewFileName
Dim strRealCount '处理的文件数量
dim action
action=Request.Form("action")
strFromDir=replace(Request.Form("strFromDir")," ","")
strTargetDir=replace(Request.Form("strTargetDir")," ","")
'Response.Write action&":"&strFromDir&":"&strTargetDir
if action="start" then '开始改名并转移
Set objFS = Server.CreateObject("Scripting.FileSystemObject")
Set objRootFolder = objFS.GetFolder(strFromDir)
For each objFile in objRootFolder.Files '规则k40-12A.vox---->k_40_12.vox k9-4.vox--->q_9_4.vox
strPrevFileName = objFile.Name
if (instr(strPrevFileName,"k")>0 and instr(strPrevFileName,"A")>0 and instr(strPrevFileName,"-")>0) then '答案
strNewFileName=replace(strPrevFileName,"k","k_")
strNewFileName=replace(strNewFileName,"A","")
strNewFileName=replace(strNewFileName,"-","_")
Response.Write strTargetDir &"\"&strNewFileName&"<BR>"
objFile.Move strTargetDir &"\"& strNewFileName
end if
if (instr(strPrevFileName,"k") and instr(strPrevFileName,"A")=0 and instr(strPrevFileName,"-")>0) then '问题
strNewFileName=replace(strPrevFileName,"k","q_")
strNewFileName=replace(strNewFileName,"-","_")
objFile.Move strTargetDir &"\"& strNewFileName
Response.Write strTargetDir &"\"& strNewFileName&"<BR>"
end if
Next
end if
%>
<form name="changFileName" method="post">
原来目录:<input type="text" name="strFromDir" value="<%=strFromDir%>" size="50"><BR>
目的目录:<input type="text" name="strTargetDir" value="<%=strTargetDir%>" size="50">
<input type="hidden" name="action" value="start">
<input name="but" type="button" value="开始改名并转移文件" onclick="changFileName.submit()">
</form>
</BODY>
</HTML>