- 威望
- 9084
- 在线时间
- 1242 小时
- 金币
- 6985
- 贡献
- 300
- 存款
- 1660001
- 最后登录
- 2026-5-10
- 注册时间
- 2006-5-10
- 帖子
- 1840
- 精华
- 6
- 积分
- 15415
- 阅读权限
- 200
- UID
- 10
   
- 威望
- 9084
- 在线时间
- 1242 小时
- 金币
- 6985
- 贡献
- 300
- 存款
- 1660001
- 最后登录
- 2026-5-10
- 注册时间
- 2006-5-10
- 帖子
- 1840
- 精华
- 6
- 积分
- 15415
- 阅读权限
- 200
- UID
- 10
|
ASP文件操作大全( s7 y- V- n/ k! i0 E' q1 h8 l" B
<% " I5 d* a: k. q# H0 Z m
Class Cls_FSO
$ O- P' w) f* b+ t' QPublic objFSO / C: v6 e+ N) Q2 a: R r
Private Sub Class_Initialize()
: d" J$ R, t' Q7 C' h) z. oSet objFSO = Server.CreateObject("Scripting.FileSystemObject") : A7 F" r7 V5 z- k1 M; t: U+ Z6 p
End Sub ) c0 @5 Y. H" q, }
Private Sub class_terminate()
" `) C3 x) V4 {+ `Set objFSO = Nothing
7 Z5 U7 m+ C5 B9 Y' qEnd Sub
% ?% q( \9 ^/ A- y- L& j5 m) h" F' i) J( E; |" I) U
'=======文件操作======== 4 I% f' x6 y |0 D! s* v
'取文件大小
4 b: Y' c" q- N+ Q2 PPublic Function GetFileSize(FileName)
4 d$ }1 r3 F5 u" j( L, @Dim f " \, L2 d0 }# i4 K4 Z3 m
If ReportFileStatus(FileName) = 1 Then : _" x% r( Z2 B) E d9 u! ~
Set f = objFSO.Getfile(FileName) * J7 X! a; z( n4 @; m
GetFileSize = f.Size 6 m- i( \* B, a0 K
Else ) P# }6 k/ k, \5 A6 N Y
GetFileSize = -1
1 Z% [: Z( D0 c* O: A) UEnd if
3 j+ n3 ]& K/ T: i( }, n. ~3 q' F) AEnd Function 4 e8 J( q4 |7 h! p8 ~& V& Z6 g
* p2 k4 f. N9 w7 a: X0 M. `* e
'文件删除
4 [2 V# P+ f# Q. k- xPublic Function deleteAFile(FileSpec) ) J5 y+ U+ q \) E' l
If ReportFileStatus(FileSpec) = 1 Then
. n7 F" q- X* c% H$ h+ hobjFSO.deleteFile(FileSpec)
- V+ S4 O8 s4 d. q/ j2 PdeleteAFile = 1
" X/ w* v V" O0 e, U, i+ PElse
) h: X4 F6 o3 w! ldeleteAFile = -1
2 l$ L- e" J0 s6 s1 K+ ^! i* i% tEnd if
8 E" X- N* c. W2 `* \# G6 ]0 ?( tEnd Function
( `0 V- \2 m" `0 X& ?- I) h* t: ^8 |0 x6 b$ V: B- b6 `
'显示文件列表
* P; z4 A/ E2 \6 e/ O4 JPublic Function ShowFileList(FolderSpec)
6 \ i' U" g4 P* o" j. t& B4 E+ FDim f, f1, fc, s & f, F2 o. a e; Q4 x4 P
If ReportFolderStatus(FolderSpec) = 1 Then
d% G9 x: X: U0 y$ Z8 nSet f = objFSO.GetFolder(FolderSpec)
9 _: }3 `, R8 ~; \* m$ @Set fc = f.Files , N# N, r% W) T3 R6 [
For Each f1 in fc
+ T+ s& f8 M% F; Z8 m* J* Ys = s & f1.name
7 H, X x3 V. k$ G+ Ts = s & "|" ) a" B2 ~! f3 o, w* D
Next
1 _% r& K2 i. D& S0 A! G6 TShowFileList = s
+ g/ b8 T6 X% K% a" TElse ) B! \% N, ~) K% \3 S5 S
ShowFileList = -1 , `: @9 t* L. v
End if ) r2 b& v0 K. ?
End Function 4 N' |$ e! B( b' N2 T" T
X5 U: s5 \; V8 h Y8 {% l6 m
'文件复制 : C; }1 i$ |8 b2 c. O, H1 a
Public Function CopyAFile(SourceFile, DestinationFile) - ?6 D% B3 {, U# j* l% T
Dim MyFile
' A3 B, ?8 X5 U5 V8 {0 ~If ReportFileStatus(SourceFile) = 1 Then : N3 _& S- p V& M% v- f% Z
Set MyFile = objFSO.GetFile(SourceFile) + z$ G% D0 d7 e' S
MyFile.Copy (DestinationFile) 2 b9 o6 H G, |3 Z2 @3 @) i- ~
CopyAFile = 1
2 i" i- z7 {6 cElse . R( Z$ K0 \8 D# h& v8 z0 N2 @8 w
CopyAFile = -1 9 N1 x' e: c) P9 u
End if
2 @2 r6 f6 L4 U9 l( K [End Function
) }# R' N7 t/ w2 A) } B
. u5 q ]7 b3 W. P ]'文件移动 % T' h) Z5 H/ d
Public Function MoveAFile(SourceFile,DestinationFile) 7 `: N/ T9 {9 |
If ReportFileStatus(SourceFile) = 1 And ReportFileStatus(DestinationFileORPath) = -1 Then + {4 D( e" K8 L: Y+ P
objFSO.MoveFile SourceFile,DestinationFileORPath
/ C% E# M5 u! z0 ^MoveAFile = 1
* ^! L, h1 m* p) N0 ZElse
2 w; G& `1 i+ f& O4 VMoveAFile = -1
" u A8 w' ~; ]: r; lEnd if
: `% E d! P) \2 I) b* P1 ?2 X% hEnd Function
! G2 J) f2 l' N; c3 c% }7 X1 ?, O9 Y$ D/ g- g7 g" _
'文件是否存在? 8 O% l' j% [' }- P) t' i9 t
Public Function ReportFileStatus(FileName)
3 o$ j3 q' X8 F6 b: {% HDim msg . v8 ~5 Y2 o; p0 G# Z! z6 }
msg = -1 ! T' O; A: {$ W7 m: |3 w4 _
If (objFSO.FileExists(FileName)) Then $ x6 [ A8 N0 y @' L" a2 B! Q" ^' K
msg = 1
" W ^" U$ B" q6 j' y/ b. xElse
* c( ?/ j( T7 wmsg = -1 7 i( x/ H# h2 j8 S% G/ d/ A7 a
End If 6 ~# k; b1 L& ?9 g
ReportFileStatus = msg 3 |7 `# g6 W% I1 y1 W0 L
End Function . }1 o# x9 _; v' Z/ H$ ^
% x" u) }8 A% q+ b8 P. b. z S T'文件创建日期
; U9 a# i) j4 a6 y7 EPublic Function ShowDatecreated(FileSpec) 0 C m( V- @4 ^ N+ n
Dim f . I; y9 E# t& w. K1 i
If ReportFileStatus(FileSpec) = 1 Then
* j* `* v5 S; j7 v" r$ }Set f = objFSO.GetFile(FileSpec)
9 [ u& t" l8 b' h' kShowDatecreated = f.Datecreated , C$ b( s$ }. p4 Q2 `4 H* y
Else
, y, N( s. Y+ I8 sShowDatecreated = -1 9 F4 ^2 l- W: \' T; A( ?
End if ' _$ V5 H: w# F; z
End Function
% q% K/ C1 {! k" Y+ o$ D" H+ w& u& ~! N4 T3 |. K
'文件属性 : i: m4 A E% r: Z
Public Function GetAttributes(FileName)
3 ?: \* U$ [: ]4 C% t7 H& U( zDim f $ T% r) J1 J: a ?+ L, W2 L
Dim strFileAttributes |% Y5 @4 a2 S1 P T7 v" D
If ReportFileStatus(FileName) = 1 Then
/ ^5 U: ~, j- T5 z9 ISet f = objFSO.GetFile(FileName)
2 L3 j) ~3 G( H5 q1 M7 s' uselect Case f.attributes
6 r% x1 `# h q$ i k- U* c) yCase 0 strFileAttributes = "普通文件。没有设置任何属性。 " $ Y% T* E6 P1 {! q7 _) `
Case 1 strFileAttributes = "只读文件。可读写。 "
* r5 R9 G/ _# g9 y# D' eCase 2 strFileAttributes = "隐藏文件。可读写。 " 6 V! m4 |; ]1 [; [" t' I
Case 4 strFileAttributes = "系统文件。可读写。 "
5 V; \+ i! F J6 @# @/ g! ~# VCase 16 strFileAttributes = "文件夹或目录。只读。 " 2 h! c) Y9 m+ { u6 r1 v6 ^9 ]. g. G
Case 32 strFileAttributes = "上次备份后已更改的文件。可读写。 "
% C/ ~6 ^2 B$ G$ r2 lCase 1024 strFileAttributes = "链接或快捷方式。只读。 " 3 M% V7 p. ?. V8 Z# h# V5 D& \
Case 2048 strFileAttributes = " 压缩文件。只读。" ; K% F1 X: i4 f" u
End select 5 t7 q" \& j1 y7 ]( Y. B" \& u+ {' f
GetAttributes = strFileAttributes 9 |- V0 {- E, d: h
Else
0 P* A. M4 \- _* n$ P# mGetAttributes = -1
@% R2 Q* d% l' n3 PEnd if 7 A% y) c' C' n) V+ S* p8 `
End Function
/ s( O- ^/ ~ V# @/ c4 l" _
, d( D3 L+ c" U t4 O'最后一次访问/最后一次修改时间
! R9 ~' \# d# u; FPublic Function ShowFileAccessInfo(FileName,InfoType) 2 W% [, ^3 R# `- D# m/ e
'//功能:显示文件创建时信息 6 u+ B2 P V* }+ u
'//形参:文件名,信息类别 5 h. ?- |$ K% m
'// 1 -----创建时间
7 U% c1 i8 d& C- t0 L c% _* p# j) ['// 2 -----上次访问时间
) M# {+ I- j( n2 n6 u8 u'// 3 -----上次修改时间
$ o8 L) x; l6 Y( l) ['// 4 -----文件路径
4 t8 O6 V6 n+ @3 o'// 5 -----文件名称
5 J' D" o$ h P4 d% C4 a'// 6 -----文件类型
# O8 t2 a8 k0 o'// 7 -----文件大小
) B2 P7 q [6 J ?+ ['// 8 -----父目录
1 F; ~# ]& \/ G8 c+ X0 d, @! r'// 9 -----根目录 - m# o& I5 x# o
Dim f, s 3 D/ G" D" {) r9 B3 \, D
If ReportFileStatus(FileName) = 1 then
; d. q' u2 K5 p, N0 E. l4 ]5 BSet f = objFSO.GetFile(FileName) % f7 ^: _/ h* m4 V- L2 r
select Case InfoType
$ H2 @7 v- E8 ], X0 M- ~Case 1 s = f.Datecreated * }: l3 U& T6 }0 u2 v+ J- {
Case 2 s = f.DateLastAccessed
9 j, ]7 T9 a! G) A: B1 E8 uCase 3 s = f.DateLastModified ! F: Y$ k3 ]+ H
Case 4 s = f.Path
2 U# \; m" c2 uCase 5 s = f.Name , B# E$ R7 r8 X1 W
Case 6 s = f.Type 9 X) j$ E; r3 e1 J6 d' b
Case 7 s = f.Size
/ K5 H4 C% J9 u) ACase 8 s = f.ParentFolder |! P& S! O1 u3 b
Case 9 s = f.RootFolder
; x: J- y7 J1 z/ a4 f6 S+ wEnd select * h7 {) P6 g4 Z2 E( }, g" x# P+ J
ShowFileAccessInfo = s
% ^8 _, p2 n" _- V s3 K& Z, H3 kELse
2 _8 K5 X7 ` f' hShowFileAccessInfo = -1
) d+ \8 p5 P& ~9 vEnd if
( b7 l; \4 `9 n1 }8 ]5 F2 P. ^End Function
) r0 e% C' p L* T: g
( V9 ?) ^& D" i5 N( ]% H* q/ \9 ~'写文本文件
# T0 J- \9 n+ H+ K$ w& m, J. w+ UPublic Function WriteTxtFile(FileName,TextStr,WriteORAppendType)
. q. H- Q( |* Q8 Y [Const ForReading = 1, ForWriting = 2 , ForAppending = 8
t6 c# k3 N) L, [Dim f, m 2 E2 A0 |( j9 j j6 G
select Case WriteORAppendType " r; i) c4 P& w6 F7 y
Case 1: '文件进行写操作 ' b& _2 v. C% \6 f
Set f = objFSO.OpenTextFile(FileName, ForWriting, True) 4 S& S0 [6 {$ o( ^& e/ Z
f.Write TextStr
! u4 g: @$ {$ H5 w* ff.Close 1 y4 n* h: m0 U& Z( x# K4 U. ]3 o
If ReportFileStatus(FileName) = 1 then
A% Y9 l& [7 G7 m$ N z( OWriteTxtFile = 1 # ~& ]+ A8 I9 S# q& P7 g' W
Else
4 l C! {! K* M0 k4 k' u r+ r8 @WriteTxtFile = -1
' t* M) e& O( P C; u& Y$ ]End if
- V, |$ A" P* r7 I/ FCase 2: '文件末尾进行写操作
8 u1 b) q- M( r A' oIf ReportFileStatus(FileName) = 1 then * L k; W5 Z3 j7 h q& ~( e$ {
Set f = objFSO.OpenTextFile(FileName, ForAppending) % U6 N h2 W: [5 h
f.Write TextStr 6 l4 z/ @5 L* x' l" [ e) h3 ~
f.Close , d E' Z% }3 O$ N- F8 P
WriteTxtFile = 1
/ H/ n+ h9 q; x7 ?! a2 tElse
. j8 [, B% j" t3 \* d* @% @& RWriteTxtFile = -1
& [/ V' k8 v' {: _/ QEnd if
5 L: t- E: q6 n0 w2 W& k) LEnd select 1 `& [& j( v m0 Z/ n. f' O
End Function
/ b& l+ K5 ~9 q, A" W* m6 A4 X; r: ^* @5 _0 N T0 v
'读文本文件 # M! _" T5 L, Y6 j, j) \
Public Function ReadTxtFile(FileName)
- x) T5 @4 x# j d& bConst ForReading = 1, ForWriting = 2 * U. O+ r; ?( q& G) k* X6 R; i. i
Dim f, m 4 |, _- E& K. W6 E- S$ ^
If ReportFileStatus(FileName) = 1 then
& b1 H$ l9 |" ~7 T$ j4 cSet f = objFSO.OpenTextFile(FileName, ForReading) ! Y. x& d0 ?1 K. d
m = f.ReadLine 7 j" u. u% {. Q
ReadTxtFile = m
5 c1 n$ k- C! v+ j. \( lf.Close
! [. H4 K2 Z7 y3 ?. t6 }Else
. d3 f m$ o! A% Q+ ^3 k5 qReadTxtFile = -1 + ~8 W, K; j. r- N
End if % _2 m/ F. P3 Q
End Function
* x5 T+ p/ _; {/ A" `( `% U2 K: | k+ U, J
'建立文本文件
$ `5 l/ z5 f7 a- a
' O4 b1 k/ [7 s6 _6 @" C) @'=======目录操作========
( A6 ]- y# R* z/ I4 }7 g'取目录大小
6 G& _) I' r5 O' D# y( FPublic Function GetFolderSize(FolderName) * L7 [6 j6 |& A# [
Dim f
( {0 [5 n( o# A" yIf ReportFolderStatus(FolderName) = 1 Then * ]! ~6 m g" y( ]& f
Set f = objFSO.GetFolder(FolderName)
6 U$ i8 }1 p) R u$ z( k; jGetFolderSize = f.Size 0 y: _& g) `) q. o0 w! K- R) }# A4 e
Else . u) x# |$ X3 z' s( r* J' @: W
GetFolderSize = -1 . }: E: G" q/ q$ U0 I/ B8 U% f5 }( c
End if ; q9 L6 W5 D2 x$ S
End Function 6 ~6 |8 p! f1 e) d; V! X
' b+ V! g$ n# f0 O0 v2 j/ l'创建的文件夹
+ l3 j( ~# e# o, qPublic Function createFolderDemo(FolderName) 4 n6 Q; C) G( @, ?0 g
Dim f / K6 U6 o8 ~$ m- S% B0 q. p t' v& D
If ReportFolderStatus(Folderspec) = 1 Then 5 m% m' A& A' m* p
createFolderDemo = -1 + s+ k8 C E7 ~0 n9 {, K: O& P$ o
Else $ n# |, W, i: v
Set f = objFSO.createFolder(FolderName)
( a/ W0 I& t0 ~. JcreateFolderDemo = 1
* W5 M* _+ X; Z+ @6 r; SEnd if ; A' Z5 N/ g* [) K; q
End Function
( z. j8 @+ ]+ ^7 j! ?# \- K7 ~1 V( s# y
'目录删除 ' u, H( ?+ }) z3 n
Public Function deleteAFolder(Folderspec)
: }% }! Q- v# _* WResponse.write Folderspec
. N$ B, k) M4 J5 s8 }5 a5 fIf ReportFolderStatus(Folderspec) = 1 Then 8 i% Z! Q* T. F0 r4 ?4 }
objFSO.deleteFolder (Folderspec)
: O# ?* s5 g5 [$ E/ n7 zdeleteAFolder = 1
) u' W- `3 L" W9 hElse
0 T% _2 [1 ]! ndeleteAFolder = -1
; w |) G) K- |+ u/ p0 h( A5 iEnd if 3 c# e& @" y; _4 H
End Function 0 d9 M* X3 e, N" P
- A: b$ ]" ^9 e; w3 S'显示目录列表
' |5 Y5 J- Y% F3 VPublic Function ShowFolderList(FolderSpec)
0 _( ]/ i; Z. V' }' E9 l# pDim f, f1, fc, s : c0 V, `3 m3 f" Z
If ReportFolderStatus(FolderSpec) = 1 Then - i3 U' X* T0 I- A. A# d2 g! t
Set f = objFSO.GetFolder(FolderSpec)
1 F7 ?* [! @( q( ySet fc = f.SubFolders & `6 a" @, s# P* p0 v
For Each f1 in fc
+ M. Q2 {' Q5 bs = s & f1.name 7 @3 [5 c1 z, k4 m) I
s = s & "|"
; j& D' I! J/ ~7 G, X% S1 k' z- k; ANext
6 z# A$ ~/ B# j$ c; |ShowFolderList = s
2 M, J/ p; `6 w9 E' t- ZElse 2 W& A- I) k5 {7 m; K
ShowFolderList = -1 8 M% q \0 D' r- M7 |" z J' w
End if
+ z# I% |' N& K7 u/ g7 }End Function
% o r! Q8 w4 h v4 Z ~+ F
: i( k4 D) w* V0 {9 f5 v'目录复制
$ t/ m2 L. e) K5 b) TPublic Function CopyAFolder(SourceFolder,DestinationFolder)
( v. h5 [/ s5 e7 A: |2 d8 wobjFSO.CopyFolder SourceFolder,DestinationFolder
6 r. u- W! n1 E9 PCopyAFolder = 1
- p- Z$ `3 z5 { B: jCopyAFolder = -1
. \8 ~1 B' P5 j C) p5 a! I' z$ x7 {End Function
' `4 f; x0 `7 I8 Y$ k( Q" W$ q$ t" |5 ]) @
, q4 d8 l% J; z' m" |& ~
'目录进行移动 5 j$ C6 Q/ L4 _ S& U
Public Function MoveAFolder(SourcePath,DestinationPath) * ~6 g3 _; u8 `6 R$ y# Z9 J
If ReportFolderStatus(SourcePath)=1 And ReportFolderStatus(DestinationPath)=0 Then ; W# V2 D y! ^6 S! ?# W* T" n& U; L
objFSO.MoveFolder SourcePath, DestinationPath 9 O: l0 d' a# z6 u4 x' p
MoveAFolder = 1
% m# c! R p2 _Else
0 G/ T8 Q8 Y- x2 kMoveAFolder = -1
0 \2 K! P1 }+ ~7 `" D. C' M. T( HEnd if 0 n a3 i3 h* a7 p+ C
End Function
( y: b8 i3 v% {) ?" y4 ~9 F
( y2 w9 h f' |* l! r'判断目录是否存在
( [0 n1 X. V- z+ |Public Function ReportFolderStatus(fldr)
! r8 v2 S" ~' Q( FDim msg
* Z$ Q G7 c& ]% s Ymsg = -1
" o" z5 Q7 E( ^) t- KIf (objFSO.FolderExists(fldr)) Then
7 D; j5 r* C+ f F1 cmsg = 1 0 q6 t6 _% R5 n' v' ~# V; T( q
Else 6 i2 M+ i u* o n; d
msg = -1
/ y( {) @7 p! z$ |0 YEnd If
3 x8 t' J+ P5 x+ O4 @ReportFolderStatus = msg
1 E$ |( S$ n$ x. j; Q5 k: _End Function % ^/ ]5 Y3 J% J# t% ^- M
" B& V) f' F9 L/ n% c8 R% B; R5 X4 Y'目录创建时信息 . ~8 m) p8 E. O- `4 j8 H" h5 T
Public Function ShowFolderAccessInfo(FolderName,InfoType) 1 P( b# h, E/ M# |; E7 @2 D+ r$ ~
'//功能:显示目录创建时信息
* Y; G3 }/ ?7 v, A, ~- |" h& {1 a'//形参:目录名,信息类别
/ ^! E5 ]7 R0 W0 M2 _: X+ Y4 `'// 1 -----创建时间 & \; J0 a9 A* ]0 U9 R
'// 2 -----上次访问时间 ) `, g* k: @7 j
'// 3 -----上次修改时间
7 Q; w9 n' q- j! [: \'// 4 -----目录路径 8 B; E% L0 A5 m
'// 5 -----目录名称 2 `8 |3 L% D- d
'// 6 -----目录类型 + _8 b! B9 V* w/ G$ S; R
'// 7 -----目录大小
) p: Q1 J+ V3 a* q* |'// 8 -----父目录 $ o$ ?* B1 ]% a8 K. q. C! ?$ i, h: e
'// 9 -----根目录
/ @% m( D4 m* X9 ~' rDim f, s 9 q! \8 @0 O8 U$ u3 s
If ReportFolderStatus(FolderName) = 1 then
! }$ l) d. u! H# `: @Set f = objFSO.GetFolder(FolderName)
; b/ |, l1 A! g$ W/ V! s4 `% Aselect Case InfoType
4 L) R8 P, S8 R) @Case 1 s = f.Datecreated 8 }2 Z8 H+ G$ f/ o" f: ]
Case 2 s = f.DateLastAccessed
0 J1 o( w6 g% `+ bCase 3 s = f.DateLastModified & f( X5 Y* e) l: O0 C; x9 \
Case 4 s = f.Path . N' A# {% Q; o+ B l; ^9 r9 m$ ^1 q0 k
Case 5 s = f.Name
3 Q2 u9 [, I: h, J' ]6 w' iCase 6 s = f.Type 6 L# E g* W5 ]
Case 7 s = f.Size 0 x. |9 G. @& G9 |
Case 8 s = f.ParentFolder
. m' G& k5 m& N5 R1 OCase 9 s = f.RootFolder ; C0 U; K& z. J7 [, ?6 m
End select % E8 _! P0 @: V. q
ShowFolderAccessInfo = s ( V6 ~: O) M4 x6 C
ELse 7 b# h+ W5 U0 h9 Y; _
ShowFolderAccessInfo = -1 ) f8 ?$ o; R2 P* O9 B0 B& p8 b
End if
2 O/ S6 r+ U+ o+ D8 K, H0 lEnd Function
' g! h+ F! n( P0 I# ~) u3 Y. c6 {
'遍历目录 8 ^- v; v+ c9 X2 A2 D% K2 P
Public Function DisplayLevelDepth(pathspec) : {2 X; Q; H$ n5 y: o( l) T
Dim f, n ,Path ( A7 Q' w& S! h* }; D7 h
Set f = objFSO.GetFolder(pathspec) & W! u* ~9 U0 [: e- `
If f.IsRootFolder Then 6 e* `5 k; P1 k. y" k# q
DisplayLevelDepth ="指定的文件夹是根文件夹。"&RootFolder . ~) J% A \: q \: g6 c( Q% s
Else & k) _' g7 c# @/ Y5 G, r, z
Do Until f.IsRootFolder
5 S8 ?6 h! N. VPath = Path & f.Name &"<br>"
) T7 x9 n- r$ I% x. {* Y& ASet f = f.ParentFolder - P1 g9 G3 D3 Y5 y5 V5 C w
n = n + 1
/ |: A0 K1 x( ]9 s) G6 tLoop
, ]* P% p( ^' u; PDisplayLevelDepth ="指定的文件夹是嵌套级为 " & n & " 的文件夹。<br>" & Path
; I- u2 r5 i/ R% B( O* A1 `- Q, S: [End If Z: g0 I B3 d2 Y
End Function # g$ |! f7 l$ ~5 _% u, y
% C8 ~' }9 \3 ~: `' S) a% w
'========磁盘操作========
" @5 S6 n4 f) m" ]7 J'驱动器是否存在? 0 d1 M; Y( B% ]% u
Public Function ReportDriveStatus(drv) + H" w2 K6 C2 x: @+ q+ r
Dim msg
* d% r2 ]$ x; D1 n- w7 amsg = -1 / V7 ]1 D, X' r, b/ T- K: L+ k
If objFSO.DriveExists(drv) Then
+ }7 C/ ]. [( Imsg = 1 9 i- J. m% }) i0 T1 j- Z
Else
X# `+ c- Q* f( S7 ]msg = -1
! `- F& L: \$ X# y. IEnd If ( L, t+ [" @; E% {
ReportDriveStatus = msg
2 |- U, \( Y' DEnd Function
" v5 w6 D, I. J& [6 s
1 H0 p9 U/ g* g1 b3 v'可用的返回类型包括 FAT、NTFS 和 CDFS。 1 a8 F3 p8 u# K: k
Public Function ShowFileSystemType(drvspec)
. z* `0 I& S0 V. P9 F4 t0 S! UDim d ' \4 V; Q8 U9 x Z7 a
If ReportDriveStatus(drvspec) = 1 Then ( u! \( S' {: @5 K
Set d = objFSO.GetDrive(drvspec)
, Q0 s$ Y- I; n7 n j" fShowFileSystemType = d.FileSystem
0 B3 P- H0 `) H; yELse
) [) P6 e v9 ] NShowFileSystemType = -1 2 @: Z7 l7 a- a
End if 8 T4 `3 L' D, T
End Function
% {; G/ R2 g: L) a9 P& o4 p! jEnd Class 1 w7 c4 t2 b8 J8 ^) G
%> |
|