上一篇:在线修改Serv-U 4.2用户密码 >>
asp 中常用的文件处理函数
<%
@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#
@#所有自定义的VBS函数
@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#
function DeleteFile(Filename) @#删除文件
if Filename<>"" then
Set fso = server.CreateObject("Scripting.FileSystemObject")
if fso.FileExists(Filename) then
fso.DeleteFile Filename
end if
set fso = nothing
end if
end function
@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#
function CreateDIR(byval LocalPath) @#建立目录的程序,如果有多级目录,则一级一级的创建
on error resume next
LocalPath = replace(LocalPath,"\","/")
set FileObject = server.createobject("Scripting.FileSystemObject")
patharr = split(LocalPath,"/")
path_level = ubound(patharr)
for i = 0 to path_level
if i=0 then pathtmp=patharr(0) & "/" else pathtmp = pathtmp & patharr(i) & "/"
cpath = left(pathtmp,len(pathtmp)-1)
if not FileObject.FolderExists(cpath) then FileObject.CreateFolder cpath
next
set FileObject = nothing
if err.number<>0 then
CreateDIR = false
err.Clear
else
CreateDIR = true
end if
end function
@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#
function SaveRandFileName(byval szFilename) @#根据原文件名生成新的随机文件名
randomize
@#ranNum=int(90000*rnd)+10000
@#if month(now)<10 then c_month="0" & month(now) else c_month=month(now)
@#if day(now)<10 then c_day="0" & day(now) else c_day=day(now)
@#if hour(now)<10 then c_hour="0" & hour(now) else c_hour=hour(now)
@#if minute(now)<10 then c_minute="0" & minute(now) else c_minute=minute(now)
@#if second(now)<10 then c_second="0" & second(now) else c_second=minute(now)
fileExt_a=split(szFilename,".")
fileExt=lcase(fileExt_a(ubound(fileExt_a)))
SaveRandFileName=replace(replace(replace(now,":",""),"-","")," ","")&int(10*rnd)&"."&fileExt
@#GenerateRandomFileName = year(now)&c_month&c_day&c_hour&c_minute&c_second&"_"&ranNum&"."&fileExt
end function
@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#
function jaron_replacer(strContent,start_string,end_string,replace_string)
@#CMS替换函数:源字符串,前部分,后部分,替换成的字符
@#返回被替换后的字符串
jaron_replacer = replace(strContent,mid(strContent,instr(strContent,start_string),instr(strContent,end_string)+len(end_string)-1),replace_string)
end function
@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#
function replaceplus(strContent,start_string,end_string,replace_string)
@#文档中,将所有开始,结束之间的所有字符删除
on error resume next
MARKCOUNTS = ubound(split(strContent,start_string))
PRESTRING = strContent
for i=0 to MARKCOUNTS
STARTMARK=instr(1,PRESTRING,start_string,1)
if STARTMARK=0 then exit for
COMPMARK=instr(1,PRESTRING,end_string,1) + len(end_string)
VerString=mid(PRESTRING,STARTMARK,COMPMARK - STARTMARK)
PRESTRING = replace(PRESTRING,VerString,replace_string)
next
replaceplus = PRESTRING
if err.number<>0 then err.Clear
end function
@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#
%>
下一篇:使用FSO把文本信息导入数据库 >>
相关文章:
- · NAV导致IIS调用FSO失败的解决方法
- · 构建免受 FSO 威胁虚拟主机(三)
- · 构建免受 FSO 威胁虚拟主机(二)
- · 构建免受 FSO 威胁虚拟主机(一)
- · 类似于iis浏览的功能
- · 巧用FileSystem组件实现WEB应用中的本地特定打印
- · ASP中FSO对象对IIS WEB服务器数据安全的威胁及对策
- · 文件的读出 编辑 管理
- · 怎样判断一个盘上是否有文件
- · 用ASP实现对MP3曲目信息的操作
- · 关于用ADO STREAM做的无组件上传程序简单介绍
- · 从文本文件中读取信息并存储入数据库
- · 文本搜索
- · FileSystemObject处理文件
- · 设计 FileSystemObject
- · 处理驱动器和文件夹
- · 通过数组给您的文件排序
- · 用ASP做一个TOP COOL的站内搜索
- · 怎样读取一个文本文件的内容?
- · 在线用表单建立文件夹
- · filesystemobject组件的用法示例
- · ASP中文本文件与数据库文件的数据交换(FSO)
- · 列出指定目录下的所有文件和目录
- · 读取目录下的所有文件(包括子目录下的所有文件)
- · ASP中FSO的神奇功能 - FSO不能做到的
- · ASP中FSO的神奇功能 - 用FSO进行内容管理
- · ASP中FSO的神奇功能 - 使用FSO进行搜索
- · ASP中FSO的神奇功能 - 权限许可
- · ASP中FSO的神奇功能 - 文件读取
- · ASP中FSO的神奇功能 - 写文件
- · ASP中FSO的神奇功能 - 简介
- · 读取目录下的文件得到一个数组
- · 奇妙的文件系统对象组件
- · ASP.NET2.0导航功能之配置会员和角色
- · C#+ASP.NET开发基于Web的RSS阅读器
- · 在ASP.NET程序中实现语音合成
- · 在Apache上调试ASP.NET 1.1/2.0代码
- · ASP.NET初学:建立ASP.NET开发平台
