麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 學院 > 開發設計 > 正文

ASP自動檢測創建多級目錄,fso與stream生成文件函數

2019-11-17 04:12:21
字體:
來源:轉載
供稿:網友

<%

' 網站根目錄
const global_default_root_path = "/"
' 描述: 建立目錄的程序,如果有多級目錄,則一級一級的創建
' 作者: xiaoyuehen
' 日期: 2006-6-3
' 參數: strlocalpath : string, 創建路徑, 必須為物理路徑
' 返回: True/False
function create_directory(strlocalpath)

create_directory = false

dim strlocalfolder

dim strpath, tmppath, tmptpath

dim arrpathlist, intlevel

strlocalfolder = server.mappath(global_default_root_path)

if left(strlocalpath, len(strlocalfolder)) <> strlocalfolder then


exit function

end if

 

' 獲得目錄

strpath

= replace(strlocalpath, strlocalfolder, "")

if left(strpath, 1) = "/" then


strpath = right(strpath, len(strpath) - 1)

end if

 

dim objfolder

set objfolder   = server.createobject("Scr

 

   if objfolder.folderexists(strlocalpath) then


create_directory = true


exit function

end if

arrpathlist
= split(strpath, "/")

intlevel

= ubound(arrpathlist)

 

dim i

tmptpath = ""

for i = 0 to intlevel


tmptpath = tmptpath & arrpathlist(i) & "/"

 

 

tmppath = strlocalfolder & "/" & tmptpath


if not objfolder.folderexists(tmppath) then objfolder.createfolder tmppath

next

 

set objfolder = nothing

create_directory = true
end function
' 描述:
fso 生成文件
' 作者: xiaoyuehen
' 日期: 2006-6-3
' 參數: strlocalpath : string, 創建路徑, 必須為物理路徑
' 返回: True/False
function fcreate_file(strfilename, byref strcontent)

fcreate_file = false

dim strpath

strpath = left(strfilename, instrrev(strfilename, "/", -1, 1))

'檢測路徑及文件名有效性

if not(create_directory(strpath)) then exit function

const forreading = 1, forwriting = 2, forappending = 8

dim fso, f

set fso = createobject("scripting.filesystemobject")

set f = fso.opentextfile(strfilename, forwriting, true, -2)

f.write strcontent

f.close

set fso = nothing

set f = nothing

fcreate_file = true
end function
' 描述: stream 生成文件
' 作者: xiaoyuehen
' 日期: 2006-6-3
' 參數: strfilename : string, 文件完整路徑, 必須為物理路徑
'
   strcontent : string, 文本內容
' 返回: True/False
function screate_file(strfilename, byref strcontent)

screate_file = false

dim strpath

strpath = left(strfilename, instrrev(strfilename, "/", -1, 1))

'檢測路徑及文件名有效性

if not(create_directory(strpath)) then exit function

dim ado_stream

const forreading = 1, forwriting = 2

set ado_stream = server.createobject("adodb.stream")

with ado_stream


.Open


.type = 2


.Writetext(strcontent)


.SaveToFile strfilename, forwriting


.SetEOS

end with

set ado_stream = nothing

screate_file = true
end function%>


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: av在线免费播放 | 色就色 综合偷拍区91网 | 国产精品一区二区三区99 | 黄色免费小视频网站 | 艹男人的日日夜夜 | 在线a | 国产xxxx免费| 日本在线免费观看视频 | 免费a级片视频 | 国产精品久久久久久模特 | 欧美性a视频 | 色啪综合 | 亚洲免费视 | 在线成人精品视频 | 久久久www成人免费精品 | 手机在线看片国产 | 美国黄色毛片女人性生活片 | 一本色道久久综合亚洲精品图片 | 18欧美性xxxx极品hd | 亚洲欧美国产精品va在线观看 | 夏目友人帐第七季第一集 | 一级毛片免费在线 | 国产瑟瑟视频 | 一级大黄毛片 | 最新中文在线视频 | 欧美一区中文字幕 | 91综合在线观看 | 久久久成人动漫 | 国产一区二区三区四区五区加勒比 | 999精品国产| 91久久国产露脸精品免费 | 99re热视频这里只精品 | 亚洲第一成网站 | 欧美性a视频 | 成人精品一区二区三区中文字幕 | av性色全交蜜桃成熟时 | 国产欧美一区二区三区免费看 | 日韩 综合 | 国产精品亚洲欧美一级在线 | 国产在线观看91精品 | 成人国产综合 |