- 威望
- 9084
- 在线时间
- 1242 小时
- 金币
- 6988
- 贡献
- 300
- 存款
- 1660001
- 最后登录
- 2026-5-10
- 注册时间
- 2006-5-10
- 帖子
- 1841
- 精华
- 6
- 积分
- 15416
- 阅读权限
- 200
- UID
- 10
   
- 威望
- 9084
- 在线时间
- 1242 小时
- 金币
- 6988
- 贡献
- 300
- 存款
- 1660001
- 最后登录
- 2026-5-10
- 注册时间
- 2006-5-10
- 帖子
- 1841
- 精华
- 6
- 积分
- 15416
- 阅读权限
- 200
- UID
- 10
|
ASP文件操作大全! A! W2 P% ^- r" o* w0 m% J
<%
4 ?( k6 U( e/ [( v+ N2 KClass Cls_FSO / ~ ^# Q8 O9 [. I( J' B$ t$ p
Public objFSO
0 Y* j! ^: \0 ~4 Z0 L+ WPrivate Sub Class_Initialize() 9 O+ @; q/ v( ]3 y9 W* W1 L
Set objFSO = Server.CreateObject("Scripting.FileSystemObject") 3 a; ~' B, ~0 W
End Sub
6 J1 q7 b+ g4 @7 R' xPrivate Sub class_terminate() 6 Q% B; a0 o. ?! S# g8 B6 c6 Q, Y& |
Set objFSO = Nothing 4 a* t( E1 P/ x$ h. B. X; x
End Sub , B& Y, U8 [8 X8 ?7 e2 ?: S
! i0 U2 G; `) ]7 y
'=======文件操作======== ) i3 Z" r7 P- t* x0 d0 l0 J
'取文件大小 5 W+ X7 g+ d3 G* ~! j1 k
Public Function GetFileSize(FileName)
5 c. i- u, C b+ E- UDim f ; T# T9 u% l* V) `9 G; _
If ReportFileStatus(FileName) = 1 Then ) b' A# h$ j L/ \2 h
Set f = objFSO.Getfile(FileName)
1 h0 x5 \# |- V1 ]: H; A. @GetFileSize = f.Size
. a) a4 j2 z- K$ b: a3 PElse " f! w, g/ H% d/ I
GetFileSize = -1
! T$ I' c; E% c. \$ O" AEnd if / x9 Q* @5 L6 ~$ T T6 t. E
End Function " h! |, z a; F- w7 F3 f( }6 Y
; [! j; U8 {* A0 c; b
'文件删除 8 J% c9 G: _) y1 r
Public Function deleteAFile(FileSpec) $ w r- C% I( V3 s* o- ]& S; d
If ReportFileStatus(FileSpec) = 1 Then
' I3 Y, Y6 S6 _1 u( YobjFSO.deleteFile(FileSpec) ; a8 H7 W) _# K+ s6 e
deleteAFile = 1 ' i4 Y4 B8 a% \2 y. I6 A- R
Else $ x/ [% l0 K9 d# |! [1 f
deleteAFile = -1
, k3 s) |; Z6 I% |% kEnd if g+ J$ o# Q) b; u7 d$ s
End Function
5 n' H6 q( f; M5 S7 n5 h( N( Q- }' C/ ^
'显示文件列表 1 r% b* t q+ D5 D: e r7 X& W9 c
Public Function ShowFileList(FolderSpec) : f0 W( Y W7 v+ G6 z
Dim f, f1, fc, s
; P6 ]( D$ [- ^9 _1 F. @If ReportFolderStatus(FolderSpec) = 1 Then * W# F3 i* @6 I- w- n2 ?
Set f = objFSO.GetFolder(FolderSpec)
- q, Z5 }7 P# L6 v# HSet fc = f.Files ' j; _4 e, b, l% F( r( ^5 C
For Each f1 in fc
3 o, g3 [7 [- z% U( b2 M+ Ms = s & f1.name
1 d3 B. S5 ?/ Xs = s & "|"
1 p0 R! Z% e) t: qNext
3 ~ f+ W2 M v8 z8 uShowFileList = s
( i) y) H9 u! z9 PElse 9 V( @0 V6 h) [
ShowFileList = -1 & r- z( c& D- D! U2 @+ G' G
End if
2 k1 O3 i2 ? F' R1 A* v% I2 xEnd Function & w8 t4 F0 v! h3 s7 U
: q' @2 o8 i C% u
'文件复制
# J- E7 U; d6 Z; {Public Function CopyAFile(SourceFile, DestinationFile) $ `8 h: k* `+ A6 }$ D
Dim MyFile
. U, S( b) Z' }3 I6 ~If ReportFileStatus(SourceFile) = 1 Then ; A- {0 q) m: y- x6 p
Set MyFile = objFSO.GetFile(SourceFile)
0 V1 n2 ^; z- Z% f0 {MyFile.Copy (DestinationFile) ' K2 n# R- ]% \9 Y
CopyAFile = 1
/ x. Y9 k" ?4 y2 g: uElse . m0 s& U. m' R; T1 T( {; z
CopyAFile = -1 & s4 |# p" g7 o, s; y' L1 }
End if
A- A, P# q5 s, W+ e3 Y: c5 t5 pEnd Function ) n. i( @0 z' a
. f3 m% Q3 }9 [; }
'文件移动
7 Q$ M3 T# F: J$ \8 }/ d' dPublic Function MoveAFile(SourceFile,DestinationFile)
, g9 ?: F* Q9 M6 ]If ReportFileStatus(SourceFile) = 1 And ReportFileStatus(DestinationFileORPath) = -1 Then * ]9 B H5 Y& G; a, I2 O
objFSO.MoveFile SourceFile,DestinationFileORPath
) U7 P5 Z% [! CMoveAFile = 1
, B5 r3 c7 p5 x. c0 u- kElse # m$ v# G. Q, M K7 S8 X
MoveAFile = -1 ' |1 @! x4 O e: C; X
End if
6 B e' m0 c/ Q; I' jEnd Function + I+ z0 E3 ~9 {8 M" G
! K \4 } r, b" ?( U: O5 c- S
'文件是否存在? ]8 e }3 z" W H8 m
Public Function ReportFileStatus(FileName) - A" r1 M) @, f7 ^
Dim msg
% Z% c# U+ p- Gmsg = -1
4 q7 ~2 T2 P, s. \ h8 bIf (objFSO.FileExists(FileName)) Then E U8 J; W2 B3 N: M9 e2 l, v% x- s
msg = 1 $ g8 v# n" M, G' X# k% e/ r1 v$ K% c
Else
3 O& B4 n! y' Mmsg = -1 + S* c" w3 m/ C7 h
End If 5 ~! {) U2 G5 o k. n6 o; ?1 n
ReportFileStatus = msg $ `9 C; a. J: i. V( Q+ u4 h
End Function
" M+ @$ C. l+ Z L2 Z/ z- t2 x1 d; y3 f& I3 j
'文件创建日期 + ^$ |! K% H# ^5 Q( x( C2 }
Public Function ShowDatecreated(FileSpec) 3 P, y. \, I/ Y) B0 L
Dim f
O& X* q C$ a: t! @If ReportFileStatus(FileSpec) = 1 Then
# ^. A/ @0 N' ASet f = objFSO.GetFile(FileSpec) ) y9 T" ^# K* [% g3 p9 x" B
ShowDatecreated = f.Datecreated
7 F& r. p% ]" b4 Z0 v' ~$ C; @Else
8 e/ e% X2 n L# l( n$ p4 `! jShowDatecreated = -1 ; G% V, C! I1 q2 R1 @& r5 O
End if " W7 i# f0 t z9 i2 e0 M
End Function 4 t, ~- Z3 y* D$ U) N
# X r2 Y( ? O0 |'文件属性 * e% G+ \6 r1 E* z) h2 U
Public Function GetAttributes(FileName) 6 D+ l& F- h- {4 |# f- E
Dim f
4 A) |! Y; y F6 m7 ADim strFileAttributes
1 ^& H! k. T/ `$ a! GIf ReportFileStatus(FileName) = 1 Then * m7 I- R' s1 Y/ `! n3 K
Set f = objFSO.GetFile(FileName) ; F5 b7 X m5 I' {/ ]/ R
select Case f.attributes / V6 o) u% v" N& e7 C
Case 0 strFileAttributes = "普通文件。没有设置任何属性。 " & a$ `* c' g% B/ z' B8 `. g
Case 1 strFileAttributes = "只读文件。可读写。 " + c D* s; j) j R1 c
Case 2 strFileAttributes = "隐藏文件。可读写。 " " h# v' v% C; T/ b
Case 4 strFileAttributes = "系统文件。可读写。 "
9 `7 s7 Z4 D8 N1 UCase 16 strFileAttributes = "文件夹或目录。只读。 " ( {1 z$ N6 l4 X1 w' k; M
Case 32 strFileAttributes = "上次备份后已更改的文件。可读写。 "
1 f% z$ a( ?/ \Case 1024 strFileAttributes = "链接或快捷方式。只读。 " ; R# V0 J+ W3 L: h
Case 2048 strFileAttributes = " 压缩文件。只读。"
6 d' |: A! [8 K) G) ]% ]# ?* d! ^End select
! \& P/ u' X3 k4 O0 yGetAttributes = strFileAttributes
% V5 N' J$ n: I+ @ \Else
7 Y+ b+ `, p4 F* \0 PGetAttributes = -1
; a# N6 A; i% R% h1 g3 g% t5 `) lEnd if
/ e* Z4 }$ W5 Q' S! b! wEnd Function 3 x3 o+ @& Z/ A( k- E
3 T5 _- M1 i9 U. w1 K+ ~7 ^'最后一次访问/最后一次修改时间 ! c6 k; k5 _2 i: ^
Public Function ShowFileAccessInfo(FileName,InfoType)
1 s6 R' [8 D; I, k# z'//功能:显示文件创建时信息 - u$ C. @9 s3 X
'//形参:文件名,信息类别 6 q7 g/ k, e5 K( R4 J
'// 1 -----创建时间 , i4 b4 f" ^) a
'// 2 -----上次访问时间 % C: X5 p( `+ S& b
'// 3 -----上次修改时间 ) G4 p& k- U, h7 C I, \, d
'// 4 -----文件路径
) a6 x8 L+ m: i' S$ T3 k! O'// 5 -----文件名称 ) Z' d5 P0 P( T$ \2 ?4 K4 ^1 x
'// 6 -----文件类型
/ u- Z/ H1 ~8 t+ A, [5 R'// 7 -----文件大小
, R3 `! K4 C2 g'// 8 -----父目录 " t- H* A; f5 |9 ^5 N* u
'// 9 -----根目录
1 S0 |/ Z5 _) b; p ^. D3 E6 w. _Dim f, s
, _. G/ x V$ yIf ReportFileStatus(FileName) = 1 then
8 L, E0 u5 r3 ] _+ Q! k, H% ISet f = objFSO.GetFile(FileName)
8 n8 b+ G( C' [5 bselect Case InfoType 4 x1 y: S4 I, Y% w6 n
Case 1 s = f.Datecreated
8 K S- R% j9 ~! Y# @Case 2 s = f.DateLastAccessed # z' O. y# `# m; K
Case 3 s = f.DateLastModified
7 v2 H, o% ?3 B- vCase 4 s = f.Path
, X2 W! ]6 K+ XCase 5 s = f.Name
, X" c& Z1 `! GCase 6 s = f.Type
* P+ {' O, R2 M4 Z2 Q+ K5 mCase 7 s = f.Size % \" n0 i4 Y& i% c0 B
Case 8 s = f.ParentFolder 7 Z" v+ G+ c- v$ u! `
Case 9 s = f.RootFolder & P4 p# |% R* l) z; I; A$ f
End select
+ y" }, X& r; ~( \/ y8 nShowFileAccessInfo = s
$ `6 E) h% ]' M z5 P. z8 DELse
7 _( q/ i" |" n; r( OShowFileAccessInfo = -1 6 v: {3 L* U0 K+ }" e3 O: U+ b
End if
/ K$ E9 O' n* C! CEnd Function " M4 l; W# a1 l
6 a* a4 H+ Z! W5 g2 |8 L8 u
'写文本文件 0 k+ n4 u5 _" R7 Y9 k( B
Public Function WriteTxtFile(FileName,TextStr,WriteORAppendType) 4 n8 X$ a% Q4 F+ n. D
Const ForReading = 1, ForWriting = 2 , ForAppending = 8 # D9 u0 M8 ^1 i/ G2 k% M
Dim f, m
$ L' y( R* }# }8 `4 m9 Mselect Case WriteORAppendType
0 |& s; j# \, `Case 1: '文件进行写操作
8 O4 j- p/ m; qSet f = objFSO.OpenTextFile(FileName, ForWriting, True) % i9 q5 U- W* J. {# F
f.Write TextStr
: l$ c. s3 z5 _2 N5 P4 \$ D; k: Af.Close
1 p9 ~; K* U' |+ W C9 ^If ReportFileStatus(FileName) = 1 then # G8 m6 }! J1 a5 x
WriteTxtFile = 1 # L6 H. B o) {1 o* H
Else
% M3 a4 S+ E3 M4 G" h1 _; V" v. WWriteTxtFile = -1 / |& K' Z0 \6 G% [2 r
End if 3 g3 T- f4 @! B0 Y9 b
Case 2: '文件末尾进行写操作
8 M: L! e: U% i* J6 y: r: NIf ReportFileStatus(FileName) = 1 then ; Q, ^1 C/ R- J8 z" R' `
Set f = objFSO.OpenTextFile(FileName, ForAppending) ; |3 z, z: P: C# P
f.Write TextStr - ]- E: }8 z3 ?" m
f.Close
* D# y |$ s! Y" C) bWriteTxtFile = 1 5 D3 ^* \7 b4 z7 D
Else + R$ X% Q5 _7 p6 D7 C8 Z
WriteTxtFile = -1 : r1 `2 t5 b8 v1 A& F: @
End if
; g" m4 d0 Z( `2 r) g& f! ^End select
: _6 X; D! t' a3 t! ~. NEnd Function
; i3 Y, D+ g8 T6 N1 C3 S6 J# G- N0 {/ |+ d0 S8 S
'读文本文件 $ o5 X% G7 i7 S9 k2 \5 c
Public Function ReadTxtFile(FileName)
3 Z, Q% j0 a) e- c1 sConst ForReading = 1, ForWriting = 2
2 g/ N, {1 T |4 m7 _) }Dim f, m ^* m: b5 J( c+ \1 @
If ReportFileStatus(FileName) = 1 then
' N( u) Z+ S/ r/ s' i6 mSet f = objFSO.OpenTextFile(FileName, ForReading) 5 S* ]/ Y' R8 x! {7 y( D9 ^4 ~0 o
m = f.ReadLine
% t% s; t: T- z! |+ y* s: nReadTxtFile = m
5 @; S9 G {2 ]" a( A( Rf.Close " X; W+ t* {4 d$ d. b I5 X
Else 9 Y% W+ @3 k3 k, N& W/ k
ReadTxtFile = -1 ) S* t7 m4 h0 T7 o2 F. F9 Z
End if
5 S6 Z& ?7 S4 [5 q; r& J- JEnd Function $ i; ~; g; c" I$ h. Z
, g4 {6 c2 ]0 ^! ^! n+ N
'建立文本文件 ' ~2 k9 m+ K. N% s
, u. a6 s; D! R2 q
'=======目录操作========
, |) _+ X) R; \- R. R% u* K4 I'取目录大小 4 l. t/ G' Q5 S/ f( Y% A' y: j
Public Function GetFolderSize(FolderName) " j9 K% T& k5 i- C% f w
Dim f 0 Y1 m+ e( i. W8 C5 l1 b
If ReportFolderStatus(FolderName) = 1 Then ) V- E1 W( C* G' Z
Set f = objFSO.GetFolder(FolderName) . N) e% p {2 j# c8 l3 f; v
GetFolderSize = f.Size ! I7 i! w7 ]/ u9 D8 ~
Else
. t7 L7 j5 p8 g& C- W2 I" z) y vGetFolderSize = -1 # e7 i; u5 ]+ b! H) `4 h
End if ( ^) R1 q3 Y2 S& f- @2 @1 s2 q
End Function 6 k; o- G+ j) [" K9 l" _0 Q* K8 o" F
. \. x0 ?3 T9 W6 S'创建的文件夹 & C9 D& r* ~! _7 P6 b4 I: A2 c: v
Public Function createFolderDemo(FolderName)
* D. t4 R0 k4 k( N) S$ y) ` \Dim f
8 ^- B$ S7 x9 C8 _% _. dIf ReportFolderStatus(Folderspec) = 1 Then 3 ?1 s2 q2 B2 e7 T* J/ Y4 ^
createFolderDemo = -1
6 @* \0 e: ~4 {' ~1 j8 h# YElse % D3 F3 L* `# c y+ ?9 r s8 S
Set f = objFSO.createFolder(FolderName)
. K m1 }. ?7 W( B+ r$ gcreateFolderDemo = 1 * U: R. K% [2 I! o7 P
End if
) @ p& Q+ Y$ j: M6 w; JEnd Function + {% e; B9 e8 Z) S
" u2 _5 \# [- u% }9 v% N5 r'目录删除 % M* O( }9 U1 t* G5 d8 g* r/ ^2 N
Public Function deleteAFolder(Folderspec)
8 V7 z8 c2 [$ \7 |/ S, n' y% Q2 j$ qResponse.write Folderspec
' B: g" y8 {) n" UIf ReportFolderStatus(Folderspec) = 1 Then & g# {5 w1 f" _
objFSO.deleteFolder (Folderspec) 5 Q i: e, V* O) S3 X( O
deleteAFolder = 1 . k7 L, h# Q$ d8 P
Else ; \% |0 N6 n/ Z" o) m/ M2 [. y6 A
deleteAFolder = -1 / ?4 i+ v+ U" f# f& L' w2 m
End if ; Z4 O7 M5 r5 @4 e1 z/ `( v; C6 {
End Function
- F" P9 k' R! c0 t; E
7 T. ^7 {# X/ P( ~'显示目录列表 # G! `4 q6 I, y, R" W$ G4 k8 i
Public Function ShowFolderList(FolderSpec) 2 ~: D a- Z* J
Dim f, f1, fc, s
3 k, c/ m! T( k3 z/ `If ReportFolderStatus(FolderSpec) = 1 Then
0 F6 G( L5 g3 h u! XSet f = objFSO.GetFolder(FolderSpec) $ R( u: e, l$ c/ g4 n7 j) T
Set fc = f.SubFolders
2 g% @9 V7 ~0 L# R% WFor Each f1 in fc W, ~; V9 _" @7 @7 u a) d
s = s & f1.name
- e e: w; p- I( fs = s & "|"
3 L; i5 m/ o4 D* r4 N4 M, ^Next
4 E6 M9 O" H8 M2 P) dShowFolderList = s ! w+ |" `9 P) p5 J% s
Else % S: t. J K. R- [ y8 ^9 U
ShowFolderList = -1 4 B- `( ^2 b- e9 G. m0 E7 Z& C
End if
9 \2 N. t: m3 @! c0 J/ _) _# JEnd Function
' g! A+ C& P8 b- p
# z# l4 [8 t# R# O o2 g) E'目录复制
; ]. Y5 U1 l' h: u& OPublic Function CopyAFolder(SourceFolder,DestinationFolder)
$ l K, ]6 ^, L: p# l( K; _objFSO.CopyFolder SourceFolder,DestinationFolder - l7 p/ N& |, w& P! E& u' [2 L9 I8 Q
CopyAFolder = 1 2 T% V; l( C, G% _7 E
CopyAFolder = -1 2 W: i, i/ `' W4 |7 V; ]
End Function $ F3 b, q) X+ Z1 i
; y) L1 b9 A8 b5 ~) f" m% S
+ h8 H+ o7 p- p1 O'目录进行移动
* a% m8 |- c+ r3 V3 nPublic Function MoveAFolder(SourcePath,DestinationPath) 3 |: A* E' _# w! ~
If ReportFolderStatus(SourcePath)=1 And ReportFolderStatus(DestinationPath)=0 Then 7 A& B2 t/ P* g
objFSO.MoveFolder SourcePath, DestinationPath
# r( [: c8 |, ~ w5 lMoveAFolder = 1
: Z" h# k$ x/ a3 ~- r. y0 hElse 7 k% r8 `) S9 @# n b
MoveAFolder = -1 " G& T1 d% |- F; T$ h
End if
; \! z6 m" g3 G) \* jEnd Function
( {6 s1 j* d5 w4 c: K0 Z5 Y1 M4 _. P' T) w: N& b+ F
'判断目录是否存在 & A0 V- L! S9 Q5 y
Public Function ReportFolderStatus(fldr)
' P: o, U9 f0 g! N Z9 c# nDim msg
* n" N* u# k, o$ ]5 zmsg = -1
e6 V. i5 S e' w4 ]% _If (objFSO.FolderExists(fldr)) Then
& R4 n9 G/ i+ X2 \/ i, q5 p/ U1 |msg = 1 0 D: K/ d) S1 \; w% P) }0 s
Else
8 x4 Z$ M$ G3 d$ |" amsg = -1
* P* [1 E. t4 Z; n YEnd If
/ ^8 X9 ]' o' O7 W$ _! rReportFolderStatus = msg
. p z$ r, W+ I6 L1 OEnd Function
; Z* E% Q* a* D6 p( ?; @ N: _
% z$ ]& U. B2 g+ n0 _1 _7 d'目录创建时信息
- a- E# v- N8 R$ NPublic Function ShowFolderAccessInfo(FolderName,InfoType) % I/ g3 Q# z3 k
'//功能:显示目录创建时信息 4 c. ^, v) m& l: H
'//形参:目录名,信息类别
+ D& N2 Y( t R. v" m! {2 g'// 1 -----创建时间
# m5 N$ V2 L2 b6 q5 s# O4 r7 W'// 2 -----上次访问时间
5 z7 W0 j% K$ O3 G9 N% [4 T/ h'// 3 -----上次修改时间 ( [$ g0 K9 F6 w
'// 4 -----目录路径 9 {" O& Z! \0 s; f. X
'// 5 -----目录名称 ; R$ M( a0 S7 }6 Y- b' d8 o
'// 6 -----目录类型 7 }" B3 r0 I" k' {# A
'// 7 -----目录大小
: d0 o T2 O! h'// 8 -----父目录 1 F+ Q+ |3 m2 [
'// 9 -----根目录 ( k. |2 v- B2 v2 j) S, c7 X# I
Dim f, s
% T) s5 I ` N" M/ B7 YIf ReportFolderStatus(FolderName) = 1 then
2 x' {9 z& s7 h- `Set f = objFSO.GetFolder(FolderName)
5 l7 q7 d3 }; ~select Case InfoType " |0 ~$ B4 _6 r) `/ I. U: z$ e
Case 1 s = f.Datecreated
: v7 M! V) {2 h. D& y+ T& N2 _$ xCase 2 s = f.DateLastAccessed
% O1 R; q7 m5 {$ A2 I( | P! GCase 3 s = f.DateLastModified 8 O* ?2 f: U' v2 ]( a# }. k
Case 4 s = f.Path / u A: P' B g+ P8 E
Case 5 s = f.Name
* _+ m9 X( P Y0 k/ }Case 6 s = f.Type ) U1 b# H5 \; Z; t' M
Case 7 s = f.Size * f' J5 @4 y. K# b" _1 W
Case 8 s = f.ParentFolder ( c0 T' |9 s1 M0 b8 ?
Case 9 s = f.RootFolder
" m* s* {. X. T2 _End select
$ _4 ]# u5 O; u* BShowFolderAccessInfo = s
' R6 A7 ~ X# _* XELse
5 o) R" ^; H3 X9 c" m! y ]ShowFolderAccessInfo = -1 F8 _, v9 ~ q! m( @5 ]. \7 C
End if
4 G+ h7 n$ s: nEnd Function 3 V. y5 j4 L& `) A. ^: z0 x9 N
( o. P. j8 p9 ~5 @'遍历目录
3 d* w/ y5 j# q: J+ PPublic Function DisplayLevelDepth(pathspec) ( u% P; T! d& K S' }5 g
Dim f, n ,Path ) ^6 e7 e) Z, U' i# W$ P( [; U
Set f = objFSO.GetFolder(pathspec) 8 Z" e! c6 Y9 l, _3 t
If f.IsRootFolder Then
( ?$ }- u% _( O' W0 R! tDisplayLevelDepth ="指定的文件夹是根文件夹。"&RootFolder 5 y" {1 t; U! [4 Y( y
Else
/ M; T2 T7 _5 ^6 C& k& D4 J+ vDo Until f.IsRootFolder - W v3 L. ?& [: S: t) v) ~& ~
Path = Path & f.Name &"<br>"
0 y. `0 }- T6 W" C. e7 c; q- ~Set f = f.ParentFolder ; e# J% f$ p s9 I1 k6 }8 `. U7 a
n = n + 1
& G* F8 V* L0 Q% v/ j7 JLoop
: X! p( X- S$ h0 z- a4 h" Z; t0 c9 CDisplayLevelDepth ="指定的文件夹是嵌套级为 " & n & " 的文件夹。<br>" & Path
+ K( H/ r. L, G9 vEnd If
/ j2 Q1 {! R/ C. J" X: t* l( x+ sEnd Function 5 l }+ R4 ?$ k# b/ c2 o$ a5 `8 h
, o; o; g+ r5 c'========磁盘操作========
# M' m$ Q# R- J. |0 s- A'驱动器是否存在?
1 j& G( r& F! G4 P/ n9 T+ u+ c' iPublic Function ReportDriveStatus(drv)
; a- ~, [1 m" q' ]" z4 n* G: Y; GDim msg $ e' e7 \# j# g" ?4 {
msg = -1 ! V! h" x! e# p T2 B$ }
If objFSO.DriveExists(drv) Then
6 _1 q& V( k" J7 A+ D: E' I9 C7 jmsg = 1 8 }1 x' Q* C9 K, @6 g+ P
Else
9 ^2 p) P c+ I0 ]" o4 Y( j' ]msg = -1 `( f8 f/ V# m5 I. n+ v! ^1 p
End If # z, k0 T4 _; X4 L& s: ^$ O c
ReportDriveStatus = msg & S0 [# ?0 t/ ~
End Function
4 Y/ s* I% F! Q
) `+ r& ^, f4 [. ^: B0 ]'可用的返回类型包括 FAT、NTFS 和 CDFS。
* t, ^. p: h/ }, y. H+ ^; c1 j* uPublic Function ShowFileSystemType(drvspec) 2 ?( x$ R/ [) i! V+ y. L+ F; g8 |! y
Dim d
0 }8 b( W9 b/ y4 _5 _5 K& lIf ReportDriveStatus(drvspec) = 1 Then
6 R/ g o) J; I! R& n( f- }Set d = objFSO.GetDrive(drvspec)
- D: O. @0 g% u4 E9 ^ShowFileSystemType = d.FileSystem
( I1 m( u4 H. PELse $ E9 Q4 `: Z9 r( |) x G7 e$ Z, _
ShowFileSystemType = -1
2 W2 ?: X/ K6 S# w) hEnd if 9 ?. c( v a/ I# j7 O- |
End Function
. ]$ X2 s- O0 G0 o) C: \End Class
1 A6 g/ i2 y- H& ^+ Q%> |
|