【高州情】高州人深圳站

 找回密码
 立即加入
查看: 554|回复: 0
打印 上一主题 下一主题

ASP文件操作大全 [复制链接]

管理员

论坛测试[砖]家

Rank: 12Rank: 12Rank: 12Rank: 12

金币
7308
贡献
615
威望
9151
最后登录
2026-7-16
帖子
1875
积分
25896
UID
10

论坛元老 网络高手 新人进步奖

跳转到指定楼层
1
发表于 2011-8-17 12:38:09 |只看该作者 |倒序浏览
ASP文件操作大全
! P8 F/ ~; v7 K, ~' {<% 3 ?" Q% {2 ~8 a7 y8 u6 ^1 B* z
Class Cls_FSO
$ g9 G5 |) U) c0 iPublic objFSO   l, R! _  E) y5 \3 k
Private Sub Class_Initialize()
) D( m1 q0 P# J6 v4 `$ S/ wSet objFSO = Server.CreateObject("Scripting.FileSystemObject")
% Y* L  o3 k7 Y. [End Sub
4 d9 f/ b; |# r0 y4 U( vPrivate Sub class_terminate()
/ J5 _+ K9 ]% l4 ^: x  J" BSet objFSO = Nothing
6 y/ k6 O& i; h+ `  x7 F2 J7 WEnd Sub
. t# n6 W8 L) [$ f6 R" x1 r. Q+ o1 s/ |* t
'=======文件操作======== " q9 F7 T: V1 W% u
'取文件大小
* F- a) h6 s  \& b( \4 p6 n8 }# {Public Function GetFileSize(FileName) 4 X6 O9 E+ ]8 q( U' L1 N
Dim f
: R2 V9 o1 U" {( ]- bIf ReportFileStatus(FileName) = 1 Then ( p2 ~3 s5 M! Y. a& `, B
Set f = objFSO.Getfile(FileName) + Z5 z; x% q; V& |) e" u
GetFileSize = f.Size 8 m, ]( `" y; x
Else 5 Y  Y  b; U5 n: A  E; [- t
GetFileSize = -1 5 {2 C3 l! Q8 K) r! ^( o
End if
( G2 l5 J& T) [+ R$ ]) X) PEnd Function 2 Z1 s+ m% L+ m: ?6 {
9 Z/ \& @4 m  I# p0 u
'文件删除
1 }" _+ Z9 w: j5 XPublic Function deleteAFile(FileSpec)
+ y  g1 ?% O- s/ Q2 ?, N! oIf ReportFileStatus(FileSpec) = 1 Then " x, w2 {9 j6 G, y
objFSO.deleteFile(FileSpec) " {% U# ~' u9 f2 }2 P
deleteAFile = 1 7 D+ ?8 T  y2 |) J: L% ~
Else ! ?* J; M; x( n
deleteAFile = -1 4 T" \* z) q! I7 Y' T
End if . ?2 w+ n# j" B* l( A' I
End Function
0 B; ?$ x. B1 B) J, F, a
  @. [; g+ w! G  M9 [0 X'显示文件列表 9 ]! H3 E  Q: {
Public Function ShowFileList(FolderSpec)
' c; @4 U. G; BDim f, f1, fc, s 3 ~2 j8 s. c/ u' h0 Y
If ReportFolderStatus(FolderSpec) = 1 Then ! l+ m; U$ W0 C( s+ \
Set f = objFSO.GetFolder(FolderSpec) # ^3 R5 N' D* Z" C) z6 Q
Set fc = f.Files 8 L* Y; S& W4 u1 E
For Each f1 in fc - k, @3 `9 c8 C. P1 M/ R  W
s = s & f1.name
. L- u* ~" [2 U5 o; i8 gs = s & "|"
9 H8 G, R/ ?) g8 e# L  M* xNext ! F& m8 p: ^  G( S( X
ShowFileList = s 7 b9 [' f6 M5 U  G$ _( H3 N
Else
$ I: \+ z( T9 Y, KShowFileList = -1 3 _4 B, |0 n: Q. I& s1 _
End if
! F$ i' c- \# Y5 fEnd Function
7 K9 s" O. Y% E2 E
) g! I! Q0 k% L9 K) d. e1 M  z+ p" x'文件复制 9 B  T4 o7 Q! I! L
Public Function CopyAFile(SourceFile, DestinationFile) 8 |  A; G: h" J  Y9 s; Y
Dim MyFile   i5 O$ D2 w. {6 m1 T  w$ w+ T0 R
If ReportFileStatus(SourceFile) = 1 Then
$ h# j9 I- D* K, bSet MyFile = objFSO.GetFile(SourceFile) 1 s: }1 n: }/ ^3 Z
MyFile.Copy (DestinationFile) & o9 v. ^4 n$ s7 }1 F: e+ R- ^" V
CopyAFile = 1 4 A/ |9 |8 X# a8 J3 d1 C/ w
Else . t* h: c9 Q$ ]! Y
CopyAFile = -1
2 d& M. c8 ]) K/ BEnd if
- w  L/ p6 H; g& z8 e; E- D- L; \End Function 5 _3 ^6 h) f# R, a5 w3 e; k

5 q3 ^3 H0 d+ B' o2 F( X: f'文件移动 , k6 N* h, N; A* I/ }9 B+ H  f
Public Function MoveAFile(SourceFile,DestinationFile)
6 J( s# ?3 w$ H/ u6 Q7 o. TIf ReportFileStatus(SourceFile) = 1 And ReportFileStatus(DestinationFileORPath) = -1 Then * T6 z4 m; D- _" z7 y
objFSO.MoveFile SourceFile,DestinationFileORPath 9 Z. \! F4 t! n+ R) r
MoveAFile = 1 + n4 q" m  m& J# ~
Else
2 i8 N8 O2 m' F  SMoveAFile = -1 ' S- A+ e. u6 {7 r, e3 z. Z+ }! N
End if 4 L# V0 ]$ x: h& |9 k
End Function
8 k- y* N9 o( ~5 O( D3 @
# q$ Q5 _! v2 }! t'文件是否存在?
6 ]% K+ s) _0 Z+ mPublic Function ReportFileStatus(FileName) " w  c9 Q5 R7 _  v+ f4 z- N
Dim msg
5 v5 m( {" ?! C9 c- O5 mmsg = -1 0 U- \" l" l" |9 O" {# \0 f- Z
If (objFSO.FileExists(FileName)) Then 9 V  t: P- M2 L6 S8 p9 R0 C
msg = 1 ! n! ]* S! O1 t
Else % r5 g( D. ]$ o- r- d2 l5 ~
msg = -1 - Z8 s: k8 [( I4 F# u
End If
4 E+ b* C3 T# h# x9 }2 _' HReportFileStatus = msg
6 R, ]+ R5 ]. a4 @5 F9 h& ?2 mEnd Function ; ?) V  J9 B) J: F3 G
: c- x! W7 p. b* ~' ?3 M
'文件创建日期   u) q5 m- |3 v$ v: d  d1 ^- v
Public Function ShowDatecreated(FileSpec)
7 ]% Q: C1 H& O& ODim f
  g. ]- N7 l7 E& D/ FIf ReportFileStatus(FileSpec) = 1 Then # ?) c4 F  ?4 c; F" _$ x7 {4 l5 @
Set f = objFSO.GetFile(FileSpec) 1 P6 s& l% }; x! s; O
ShowDatecreated = f.Datecreated
0 S- _+ t4 e$ M3 u; h: r) lElse
* H8 C& \% z4 h( J( I3 M* T; i  lShowDatecreated = -1 4 W. m# C+ c! Y$ \4 A1 F0 V5 |# y
End if ; L5 W4 ~9 e) w' e0 J+ A
End Function
- R# r. h5 ~% f1 ~, \6 v- b9 L7 {
8 V+ k" I9 @$ p7 n. ]# I3 z'文件属性
/ R0 j. X% n; }Public Function GetAttributes(FileName)
$ S+ e8 l+ D) |Dim f
; p: W) e% f- e2 P8 c4 F) `: ODim strFileAttributes 1 y' b& V2 A1 b/ F
If ReportFileStatus(FileName) = 1 Then
% z- `) P; r( R- f* p6 b  B- WSet f = objFSO.GetFile(FileName)
# k1 C% J* N; e2 y" U% i3 K7 dselect Case f.attributes
  Y; [* q0 j7 f' M! L6 wCase 0 strFileAttributes = "普通文件。没有设置任何属性。 "
+ g* `' K" B1 M4 [3 |Case 1 strFileAttributes = "只读文件。可读写。 " & ^* G' x+ L; Y
Case 2 strFileAttributes = "隐藏文件。可读写。 " * I* S1 c0 u" r1 ]4 a1 ?, x
Case 4 strFileAttributes = "系统文件。可读写。 "
3 [! n+ H2 N5 T7 m* S- z1 u2 KCase 16 strFileAttributes = "文件夹或目录。只读。 "
3 Z; {+ S, K% p7 zCase 32 strFileAttributes = "上次备份后已更改的文件。可读写。 "
- M* G3 @) [3 ^Case 1024 strFileAttributes = "链接或快捷方式。只读。 " ' `! p- ?% h# n/ K; g& f
Case 2048 strFileAttributes = " 压缩文件。只读。" 4 k5 j4 ^. y* U
End select $ @4 Y: }& u7 H! A' r" b+ h" R& t
GetAttributes = strFileAttributes / I. N0 e3 C9 z2 A: a4 s
Else
8 Z. |0 O' U& U* xGetAttributes = -1
8 e; g4 o; K; [End if 7 v& c5 ~. e& V
End Function % U# M- N& ]3 w

: U6 n+ x' r' f& m'最后一次访问/最后一次修改时间
5 G- J: j  t% N- H* F  H6 |9 xPublic Function ShowFileAccessInfo(FileName,InfoType) ) T8 g: s& H6 G8 g1 a: O
'//功能:显示文件创建时信息 . o& F) |. F; [! A7 _5 u
'//形参:文件名,信息类别 7 @/ ^3 A& @1 F+ x, G2 I* P
'// 1 -----创建时间 % c+ E# `% d0 H) ]
'// 2 -----上次访问时间 % }) U3 t  l3 H+ w, q7 m/ c0 T
'// 3 -----上次修改时间
! H, X0 i% {9 T( S4 I/ K. F. _( I'// 4 -----文件路径 $ y( [/ o% p: h/ u( @( T) q
'// 5 -----文件名称
/ Z7 g: v% q1 `! b8 V'// 6 -----文件类型 1 o+ f* ^6 q9 B& p
'// 7 -----文件大小
2 Z7 _( f7 B% Q# i4 e3 o'// 8 -----父目录 3 _" S4 `' }+ m1 A. |1 \8 \
'// 9 -----根目录 - c- y- |2 C9 ~, J
Dim f, s
" h; h9 D; Z4 V0 i" FIf ReportFileStatus(FileName) = 1 then
; L: |8 q# A( M0 i  jSet f = objFSO.GetFile(FileName)
3 @7 o6 s  X+ H. F" `select Case InfoType
" b6 r' q5 V2 yCase 1 s = f.Datecreated
$ Y* H. M" I7 `9 sCase 2 s = f.DateLastAccessed
( p; U4 e- V) D9 j9 q2 ]' E6 DCase 3 s = f.DateLastModified
; @2 K, _5 ]; y! N' A- w8 a" GCase 4 s = f.Path
, n: g4 v& r2 I6 e( _5 p+ aCase 5 s = f.Name
! @& p* a' a5 i5 H& ^$ bCase 6 s = f.Type 8 F( o6 B) w+ V" b0 X: `. Z
Case 7 s = f.Size : c5 z# c) e* q2 r; x: G
Case 8 s = f.ParentFolder ( t1 k* t  P/ b: p+ H  P& D
Case 9 s = f.RootFolder
4 U0 H, _: ]( m$ _, y) i2 |1 S# ]" bEnd select
- ]  r2 i4 y. }& Q9 nShowFileAccessInfo = s ! ]% n3 S* H0 E9 P3 G1 h
ELse # D) X: s. B  d5 [/ f. o( ~
ShowFileAccessInfo = -1
# A( m* u2 r$ sEnd if
% l$ V  X- g& V- lEnd Function 4 b* q; `  \; A0 C& z* j

4 G) ?" O% ~% v# C' v1 U, E'写文本文件
1 e$ c; d' I% F  W4 dPublic Function WriteTxtFile(FileName,TextStr,WriteORAppendType) 6 L+ Z6 H7 {6 G( t* f7 p% m
Const ForReading = 1, ForWriting = 2 , ForAppending = 8 * I- B& L6 B0 Q- f5 \, c
Dim f, m
. S' w% S2 a  F+ R% u' @: t( fselect Case WriteORAppendType
3 L; w# T, G# A  b& W' f. v& oCase 1: '文件进行写操作
# Y$ r: M, ^  G& l+ E4 f3 x- s# oSet f = objFSO.OpenTextFile(FileName, ForWriting, True)
( `! E1 R) L+ h. ?+ I) O3 qf.Write TextStr
2 ?! v2 E. A, b( J8 C2 q4 A4 |4 Uf.Close
8 B5 P. [' s$ |: ?: y4 WIf ReportFileStatus(FileName) = 1 then 5 s9 {, x, a( p. m
WriteTxtFile = 1
# Y) q6 ]" l6 OElse
- _& {8 X  A% O+ p( A3 P+ zWriteTxtFile = -1 ( a! L( [  n1 E" a! I2 Y
End if
& J, c' H* Z4 ^! p3 T$ @Case 2: '文件末尾进行写操作
' R* p4 Q3 t& `# z& ^% DIf ReportFileStatus(FileName) = 1 then , [9 Z4 d- z$ ^+ t4 |+ z
Set f = objFSO.OpenTextFile(FileName, ForAppending)
: h- ~0 M" L+ E' \4 Hf.Write TextStr + ^* o$ f5 t9 w7 A4 T
f.Close
5 |  q' [5 m- T$ MWriteTxtFile = 1 , Z# F5 k( w6 t" W9 x
Else " Z5 m- |  S! }* M# k2 M  j
WriteTxtFile = -1 $ C& [2 E2 W( u$ I9 o6 O% O
End if 2 h0 J& R- I$ o+ R$ l
End select
2 d4 }8 R3 R4 HEnd Function . m# I: G" H$ N. E
, r4 X2 P- Q' Q% K+ S
'读文本文件
3 K; A7 i2 g) g9 @( \* @. e7 {Public Function ReadTxtFile(FileName) " n1 m& M- S$ w% [4 u/ L
Const ForReading = 1, ForWriting = 2
8 [3 O0 V# ?1 QDim f, m
) g) j/ K  z* R0 D( e# P, p! YIf ReportFileStatus(FileName) = 1 then ; T* E  z# }  \$ c# Y
Set f = objFSO.OpenTextFile(FileName, ForReading)
9 a" ~) x- ]/ am = f.ReadLine 4 V+ o% j& v  P5 l& K- G, d
ReadTxtFile = m + A% c+ H6 M. K- B- l# o  ?$ s
f.Close
. e" S" D1 t' y0 e8 t2 tElse 5 q  @9 l! X$ o% \
ReadTxtFile = -1
0 F; G: }& [# [1 z% i) L! pEnd if 2 W7 d" a$ d0 G, [0 p
End Function / ~0 Y4 U9 N5 I( e& |! @
2 ?4 _  ], g. R* N4 u2 }
'建立文本文件 - ^. l; j  V' a2 j
( h7 M- K, P7 x2 Y5 Q  M; h, J
'=======目录操作========
$ q. V+ {2 }& s; I8 t5 V, @* b9 Z'取目录大小
3 R1 c2 Z7 i0 @! E$ TPublic Function GetFolderSize(FolderName)
3 U) C1 G% d7 B: {" s  C) TDim f - |5 l5 f; x+ `
If ReportFolderStatus(FolderName) = 1 Then 5 g/ S  ^! j! p6 Y
Set f = objFSO.GetFolder(FolderName)
8 O, B( M: _6 d3 M! y  vGetFolderSize = f.Size : w/ [  e4 u  A$ z% K$ x
Else
* Z4 h/ U' A% X' h* _GetFolderSize = -1 ' h- G6 h4 A  k; q9 y+ S$ z
End if
8 L( A% E! k" N/ T% }* REnd Function
2 o  [; f4 F* n3 p6 n- ^  w) c: P+ U* V# E: E% ^4 B" e& B% S
'创建的文件夹   m" o% u7 f) d- L9 @' G. ~& V
Public Function createFolderDemo(FolderName) $ n# e5 q8 w0 U9 i
Dim f % b) p7 u) x* _( k3 n; a
If ReportFolderStatus(Folderspec) = 1 Then ) E, j9 l7 H& t! V4 o+ I' D# ]
createFolderDemo = -1 ' a! s0 G6 @3 ?  Q/ s6 `
Else ) j6 _: W" Z" S
Set f = objFSO.createFolder(FolderName) " b+ Y5 J( k) n# T( ]1 G' y
createFolderDemo = 1
. {5 ^: t! K  D! ^) {5 hEnd if
+ i7 N7 J  D: I8 N, yEnd Function
: W# ]' H0 p* [3 D$ X
* D6 y$ c: c" ~  E  k'目录删除
! r" n; _1 @0 a' UPublic Function deleteAFolder(Folderspec)
! ~7 a# j9 l$ v6 `$ o8 YResponse.write Folderspec # p) C) |* x9 J
If ReportFolderStatus(Folderspec) = 1 Then
# g; I( i3 `( A. O+ SobjFSO.deleteFolder (Folderspec)
# S, o  x0 `7 QdeleteAFolder = 1
4 Y" |$ U1 n% M3 o4 A4 Y  O5 {Else 6 m5 c+ K# h! R+ M$ s1 ~; o' U
deleteAFolder = -1
% t3 `9 g4 n$ Y$ Q6 K, y, HEnd if . s, M7 w) K2 C- u, D
End Function
9 Y8 _* P" ~- e0 K8 r9 t& ~2 ~# [0 `' v- |9 `0 y, G
'显示目录列表 ! R; r: M8 z# i; \; c7 S- V% P
Public Function ShowFolderList(FolderSpec)
) ~1 b$ s  L- KDim f, f1, fc, s
' c7 \6 V. `6 ?, J$ ^3 A$ Y" mIf ReportFolderStatus(FolderSpec) = 1 Then ; p6 ^0 Q8 f" X. G3 p5 b/ b
Set f = objFSO.GetFolder(FolderSpec)
; \; T- f8 j1 X+ K. hSet fc = f.SubFolders 2 E% N6 A* ^, ^- O- s7 S
For Each f1 in fc # F* r+ c1 q1 j3 f2 z  _( B1 s1 B+ G# K
s = s & f1.name ( ~9 I' c8 Y* P! X" j
s = s & "|" : V! f) g4 M2 j$ i
Next + _3 k. o& f) ]& {' W5 n, E6 F
ShowFolderList = s
4 h: m" P. e: z( i: k6 G1 b% w, yElse * K; M# l+ ~7 I' k1 s& Z0 m5 \% U
ShowFolderList = -1 5 }1 G, o/ H" y& ]
End if 0 [7 i" H$ X1 T0 d
End Function
9 \, `4 f  \: V2 I" Z4 u' T% z0 S% m/ J$ Y7 ]; B* l
'目录复制
+ a+ p* ?/ O+ v: x0 BPublic Function CopyAFolder(SourceFolder,DestinationFolder)
+ `- U# h/ C1 O4 y. i, e, bobjFSO.CopyFolder SourceFolder,DestinationFolder ; d! u9 E  O0 M+ B6 ]1 U% z5 p5 F
CopyAFolder = 1
! `5 @: f+ [0 h9 j, E  N9 [, G8 \CopyAFolder = -1 / S, |' a4 O& j' k/ h5 G
End Function
! Z( b/ Q5 v* y) ~" e  S8 v# a/ C& M; h
# i3 d3 ^/ K. W1 L. W/ T, Q: r
'目录进行移动
! Z, P- W; U7 _$ j/ m$ E" RPublic Function MoveAFolder(SourcePath,DestinationPath)
$ s$ Z5 P0 R; W$ E0 AIf ReportFolderStatus(SourcePath)=1 And ReportFolderStatus(DestinationPath)=0 Then ) E) J8 _" n! E8 ?; N* z; T& a: ~
objFSO.MoveFolder SourcePath, DestinationPath
4 X! a6 y5 k8 h' w: U* h( Y5 N$ LMoveAFolder = 1 4 K, q2 P2 H; O/ d
Else : l/ C/ {: Y" Q
MoveAFolder = -1
, U3 H" v9 I5 N% C- }0 FEnd if
  T$ i8 C/ q& }9 [" uEnd Function
5 p1 H" o4 c: [* a/ R  k* q4 h% O: ~0 k
'判断目录是否存在 ( F' }6 s0 [: g! n; X) |# x% k0 E7 _
Public Function ReportFolderStatus(fldr)
6 u0 {) F" ?  LDim msg ) \4 ~6 U8 h, d' ]9 R/ T
msg = -1
) o& t) V+ w' {0 O+ aIf (objFSO.FolderExists(fldr)) Then
9 ~- e6 F+ M/ J2 umsg = 1 $ h4 @6 e* @. Q9 _
Else
' {2 |  R* R4 \msg = -1
1 _, n  q, M" c# N$ FEnd If
" w6 D8 I+ a5 n# T9 O1 eReportFolderStatus = msg
( y3 L1 A3 Q/ o2 L1 n  ?End Function 3 ~  u7 s* [- g1 H( K% D

# V3 {  v) e# e- Y# s) c'目录创建时信息
+ u: E5 A" J4 K+ O8 a  e5 PPublic Function ShowFolderAccessInfo(FolderName,InfoType)
5 F" z6 \2 Q0 _0 b; g'//功能:显示目录创建时信息
/ q; O1 {  L+ b; K* M'//形参:目录名,信息类别 + |5 f' T8 o7 m# ^- G* n; v& u
'// 1 -----创建时间
) @' \6 j; J# ~. {# X0 {'// 2 -----上次访问时间
9 W/ |- t/ C/ g" U) t. F# ~'// 3 -----上次修改时间   j. f4 G" l4 s# u/ ]
'// 4 -----目录路径 . C' e0 A& g  D  c) h; Z; S+ W* l
'// 5 -----目录名称 ; t. Y/ o6 o/ u5 w4 Q( S
'// 6 -----目录类型 9 G; V( a) ^# f& B6 t
'// 7 -----目录大小 $ T" H* T0 b9 F
'// 8 -----父目录
; _/ p* k" @7 I6 r'// 9 -----根目录
, F4 _3 ~$ r& mDim f, s
: {. s0 w- j, g. V$ ]& G5 EIf ReportFolderStatus(FolderName) = 1 then
9 b+ c8 }: F: v9 n: J" Z1 v: wSet f = objFSO.GetFolder(FolderName) 9 V# T+ m/ U. O2 V+ l
select Case InfoType ) P/ t& ]/ S( W# \( e2 A. u* ?& ]
Case 1 s = f.Datecreated 8 j  [' I+ K5 Y" \" U* g  Z- q8 H
Case 2 s = f.DateLastAccessed + _6 r, Y6 T4 l! i
Case 3 s = f.DateLastModified
$ J! X! U4 [4 t# H- u! e9 ]Case 4 s = f.Path , V! l" h5 \$ H/ ?
Case 5 s = f.Name
8 E3 p0 B% l+ {# QCase 6 s = f.Type
9 `; `: W, Q' y2 U  m, dCase 7 s = f.Size
0 H; q% j2 i# O! A0 N# G& }Case 8 s = f.ParentFolder : R& O0 j" h3 o' k
Case 9 s = f.RootFolder 0 O3 M7 y4 Y' a/ m. w) i. o
End select % M7 ?. \3 z3 D' m7 D! J
ShowFolderAccessInfo = s $ a& m# C! j1 O: ?/ v" k
ELse
% O, ^* a! q7 L8 IShowFolderAccessInfo = -1 6 a" X  [, b  V
End if
( B. ~  i. |/ [6 |2 ?End Function
; {1 w, @8 z  X2 F& }, M) V- {! H3 m8 |
'遍历目录
2 A( }% s' @: A5 Z1 N# FPublic Function DisplayLevelDepth(pathspec)
8 A% E# K/ r) h$ Z# KDim f, n ,Path % v6 a4 E% e+ G1 {8 p% m' W
Set f = objFSO.GetFolder(pathspec)
3 ?+ l+ w- o! s$ [If f.IsRootFolder Then 1 L; F0 O; j( Q3 Y. @
DisplayLevelDepth ="指定的文件夹是根文件夹。"&RootFolder % q0 n  @  S! U6 z4 C+ W
Else 6 h* L% h' n. y5 m& @' w
Do Until f.IsRootFolder 8 L5 c8 p& y. e$ C: q( y
Path = Path & f.Name &"<br>"
# h6 W' S' W& z1 G- v3 a6 GSet f = f.ParentFolder . K* x: R: Z) Y4 G. a" v1 A, c9 t% p
n = n + 1
& P2 ]  k- w3 e( Q* x! y6 lLoop 0 @" {) ^  T; [5 \, o
DisplayLevelDepth ="指定的文件夹是嵌套级为 " & n & " 的文件夹。<br>" & Path
$ K5 m0 i6 b# \) H6 BEnd If
; J- u! Q* n" D. C4 z/ v4 GEnd Function   J6 I0 P% O6 N. c1 W5 f! D- T

' i7 G& `5 A& X) W% V9 G'========磁盘操作======== 0 @+ `: U- S+ B% Z/ a
'驱动器是否存在?
4 \7 {. g% u$ a  n9 C7 u; UPublic Function ReportDriveStatus(drv) 1 K% X% V* U1 m0 k' l2 P
Dim msg
( V5 V4 S3 z. n; L$ l. {/ }msg = -1
* S  f/ B" q3 e1 t3 c' S& u" V0 E5 sIf objFSO.DriveExists(drv) Then
) N+ @. h- o; kmsg = 1
# w( `& H/ R+ G; {/ kElse
) C# K; H5 g1 C1 P- X" I4 amsg = -1 $ A3 i) K, ~9 G- {$ D8 E
End If
7 N$ @6 B+ R# g5 UReportDriveStatus = msg 6 t  p% B$ B) N4 {' ^1 \
End Function
$ C  o: @0 i3 r* O! ]# ]
0 Y0 Y% ~6 j5 z: ~'可用的返回类型包括 FAT、NTFS 和 CDFS。
; ^  y, C- @1 w5 lPublic Function ShowFileSystemType(drvspec) ( A% D" |" V2 C
Dim d " j* C$ s+ h! ^; V( q( K; j
If ReportDriveStatus(drvspec) = 1 Then
. L/ {0 s' |& bSet d = objFSO.GetDrive(drvspec)
6 @$ o. E: Z7 s* l! d- D( ~( `ShowFileSystemType = d.FileSystem
% J/ A8 I. d* g! R1 }# }0 sELse 3 P. l% I. J5 F3 y% W' {
ShowFileSystemType = -1
4 a  m7 A! u7 NEnd if
& z2 G3 t7 g7 ~9 a( I1 a1 s/ {0 u' }9 e& jEnd Function
# N, G6 u' _) [/ A: L6 F* HEnd Class
0 x9 T5 \, g/ }& G%>
这个世界只有10种人:一种是懂2进制的,另一种是不懂的。

【情系根子】〓 https://525247.net 〓

个人业余电台:BI7ILX   守候频率:1343212JJ08
您需要登录后才可以回帖 登录 | 立即加入

Archiver|手机版|高州人深圳站

GMT+8, 2026-7-28 15:02 , Processed in 0.041638 second(s), 12 queries .

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部