【高州情】高州人深圳站

标题: ASP文件操作大全 [打印本页]

作者: Longe    时间: 2011-8-17 12:38:09     标题: ASP文件操作大全

ASP文件操作大全
! i8 j; Y  O2 o) m( c8 f0 H1 }" B/ G<% # s; u0 D6 C& Y& Q/ X# ^8 g& K5 }
Class Cls_FSO
) b+ K: D% Z; }6 b: n" `Public objFSO # p" \4 O# y# {
Private Sub Class_Initialize() + ?0 Y8 n# ~* |2 C# i
Set objFSO = Server.CreateObject("Scripting.FileSystemObject") , S1 k# p9 K9 r( N: x+ U# p- v
End Sub 0 T5 d" m, i9 S  c+ J
Private Sub class_terminate() & P1 U: ~& u0 X5 Y
Set objFSO = Nothing
2 j1 i) B; W6 E. k, C7 gEnd Sub ! j& V7 E3 ]: a$ v3 e

1 B3 c6 F& H; [  x& S'=======文件操作========
' _& q% d6 K" k3 V'取文件大小 6 [0 `2 ?. [' B* S" |) v1 x! L) f* }
Public Function GetFileSize(FileName) # u9 U; q  s/ x2 r. m
Dim f
# j; D, }8 G- D3 ]6 H1 xIf ReportFileStatus(FileName) = 1 Then 4 x* U- b  K" \; }
Set f = objFSO.Getfile(FileName) " n4 z* P# ?& n% z/ D, ]2 E  x
GetFileSize = f.Size
; C! y1 L$ N& j- d- U) @Else $ X' W& h) f- t! C, b. p! e
GetFileSize = -1
# Q* @7 W/ |1 |End if
4 A! {& k3 P7 [2 ZEnd Function 0 q0 \- `5 [; z: n& Y

  ^* k! v4 {# ]1 p, W'文件删除
" q9 p, o' v, E. LPublic Function deleteAFile(FileSpec) % Q0 ~% \2 Y/ e0 r" ]
If ReportFileStatus(FileSpec) = 1 Then
7 F! n# t' x! a: d5 b2 ~! ^objFSO.deleteFile(FileSpec) * C- m4 p  R  `! Q& ~9 E6 z
deleteAFile = 1
% R1 i0 I7 h2 p$ s0 y  G' `: V6 ?Else 9 q7 U8 t5 S& _; m
deleteAFile = -1 & p3 S: w+ P) y' k/ c# i0 L2 m% u& n
End if
, M0 s- H9 l! x! S! L; bEnd Function
2 }8 Y9 Z5 B8 U' V
$ S$ L7 P1 W' I- r6 Y8 U- E, P'显示文件列表 $ g" H2 ~3 o0 h8 y( b
Public Function ShowFileList(FolderSpec) 6 E0 I3 V# y6 h0 V8 F* u- N. O
Dim f, f1, fc, s
0 x( X# D% |. aIf ReportFolderStatus(FolderSpec) = 1 Then 7 }) O. W) {8 d6 T# |! Z7 D
Set f = objFSO.GetFolder(FolderSpec)
3 o4 f8 `+ o. @) ?% a" uSet fc = f.Files : N: H7 x  k. E. \
For Each f1 in fc
" b; X' @, W( ^s = s & f1.name
6 ~9 V3 U  l) E, \# w* Ss = s & "|"
1 r2 @; I& g; N. v) uNext & D, H0 E+ e2 ^+ ]7 N/ _
ShowFileList = s
  Y7 Y1 `) q# `  f9 u; cElse
! G8 p% z, n& }! DShowFileList = -1 ( L1 n  u8 a& b6 i
End if
3 b: X( Z1 V0 l) q* k! QEnd Function
7 M! J0 c4 k9 y$ `$ p; J- w; y
. }# q5 E! [( z  G9 T'文件复制 3 D, y) ]3 g9 q4 ?5 D: s
Public Function CopyAFile(SourceFile, DestinationFile) - c' ?7 V; x7 F+ |
Dim MyFile ; E- Q7 c% j) J# O- x9 y0 C. y, T
If ReportFileStatus(SourceFile) = 1 Then . N. i& [' U1 R+ f, k; {/ n" ~
Set MyFile = objFSO.GetFile(SourceFile) 0 w# G2 I- J3 q: A  N. I
MyFile.Copy (DestinationFile) 8 [3 m  b3 S  _( \* j+ {& O
CopyAFile = 1 $ C3 z2 R2 ~" ^
Else
% g8 f( `& ]( G$ o; zCopyAFile = -1 ! m1 n4 c6 h. H+ P% p, \
End if
+ c: }) n- j" n) q' J$ I& {: SEnd Function
1 z; X+ X5 T* W" {
* k4 n# E1 O' a9 M'文件移动 , [, ]# u" e* G! h* j
Public Function MoveAFile(SourceFile,DestinationFile) 4 X0 ?- g( ]5 |$ {' N
If ReportFileStatus(SourceFile) = 1 And ReportFileStatus(DestinationFileORPath) = -1 Then
( i; C4 w( B  B7 A" nobjFSO.MoveFile SourceFile,DestinationFileORPath * u# n1 E" U( Q
MoveAFile = 1 2 C  {% }# A4 {& `* h& [+ _
Else ! i' F- Q' ]" G0 \% R
MoveAFile = -1
% B4 b. \8 @9 c1 S6 y& uEnd if
: m0 j: c2 l  d3 QEnd Function
$ H# J& t" p. {9 |. [: j
, g5 p- S7 M# Q1 a6 S' ]& d'文件是否存在? ( s0 L0 C8 L0 D" I1 H
Public Function ReportFileStatus(FileName) 5 r4 A# |9 }: E( L
Dim msg
6 P+ U6 d$ ]# w7 \msg = -1
0 b+ G. v9 _, \& e7 Q3 ~2 z6 rIf (objFSO.FileExists(FileName)) Then 9 u2 `7 |, M" ~; r( o
msg = 1
: [, v+ n5 O* f/ _0 r' sElse + U5 F/ x* a! {/ b
msg = -1 * b: s" l2 Q( `# H- M
End If 8 q9 O: B) A6 N- y$ {. J' v& P
ReportFileStatus = msg
. D, l$ Y6 V  n. ]4 qEnd Function 9 O+ P& \; ~$ V$ o2 y. j
; l/ v8 N, Y/ v7 u
'文件创建日期 8 P9 I, h' E% p, `& ?
Public Function ShowDatecreated(FileSpec) 1 [% ]) i' c4 {2 S0 N7 C6 @7 Y
Dim f # G& o8 F, d5 V6 L) B/ X
If ReportFileStatus(FileSpec) = 1 Then
4 T3 @2 Z! [" U! GSet f = objFSO.GetFile(FileSpec) 6 O% d+ y, H0 h. a8 l
ShowDatecreated = f.Datecreated . c4 W# L( r0 w
Else 5 }2 ~0 G, `5 B0 k3 w. |$ L
ShowDatecreated = -1
- i; {2 Q4 n0 u$ ~+ }7 GEnd if , g  L! x" V0 u7 A% r2 z* d
End Function
/ C& u: w5 A8 v
" o& e1 [6 L, d' I( O+ }'文件属性
4 }7 B: P0 U" O: ]* PPublic Function GetAttributes(FileName) 5 V# s! _/ M/ B8 l( w+ U
Dim f
% f2 W, m5 u8 r8 {  {% r1 l. Y0 B# X, C) @- \Dim strFileAttributes $ h$ G* U; R5 M  X% a$ H
If ReportFileStatus(FileName) = 1 Then
) u+ y8 l2 A0 P9 j# vSet f = objFSO.GetFile(FileName)
7 b$ _1 \- e* @5 {3 e9 }6 |select Case f.attributes
, l, M" A" q& F' RCase 0 strFileAttributes = "普通文件。没有设置任何属性。 " + Z6 Z0 r3 p3 B
Case 1 strFileAttributes = "只读文件。可读写。 "
# I" T2 F& |/ w3 ~  q8 QCase 2 strFileAttributes = "隐藏文件。可读写。 " 7 E: e8 q% }$ J( ]# ^6 U
Case 4 strFileAttributes = "系统文件。可读写。 " 4 b9 E4 I  `" `1 u
Case 16 strFileAttributes = "文件夹或目录。只读。 "
6 N4 c& A+ Y! u( oCase 32 strFileAttributes = "上次备份后已更改的文件。可读写。 "
! [9 V; g, o2 i2 I: Q, E/ TCase 1024 strFileAttributes = "链接或快捷方式。只读。 " 8 _( b  Y, ?& w9 b
Case 2048 strFileAttributes = " 压缩文件。只读。"
! G5 X$ D$ s/ ~" r& @, EEnd select
6 E1 G9 i3 N* {7 X: |1 cGetAttributes = strFileAttributes $ ^/ W& U5 [& O3 {, v/ m6 m9 Q0 C
Else
$ u  M  e. x+ R4 L5 MGetAttributes = -1
" S! w: E9 M( f& ]$ DEnd if
+ Y( l7 c6 g  @( C1 D6 U/ [6 TEnd Function ' m2 [: ~' U; e( I- n# u) c, ?& \& K

% M: ^, p* p  j) I' O5 V'最后一次访问/最后一次修改时间
8 j6 b/ e( D% S) CPublic Function ShowFileAccessInfo(FileName,InfoType) . r3 p" J' F- B; s$ \
'//功能:显示文件创建时信息
6 _+ i. l) p' S, F# O# i: ]'//形参:文件名,信息类别
5 [& P/ k, F, N6 t'// 1 -----创建时间 * s' c; c) R3 `9 P. E
'// 2 -----上次访问时间 # }' q2 ^! ^* t$ f" B9 h
'// 3 -----上次修改时间 : I, i$ ]! m! h3 A+ E1 v% b$ ~9 f
'// 4 -----文件路径
8 k3 g8 t" |1 `( B'// 5 -----文件名称 " c6 x, U4 [- Q, u- C' X7 w  T
'// 6 -----文件类型 * o7 \" d& U* I# Y0 E
'// 7 -----文件大小 1 X- {$ e1 h2 M
'// 8 -----父目录
& f  ?1 s; @/ J  ]$ o6 ~'// 9 -----根目录
* F* N" [' K3 g% Z% ?Dim f, s " Q8 W% r0 R) E* Q; o# w- \
If ReportFileStatus(FileName) = 1 then 3 W3 C, K5 k6 l+ v7 X
Set f = objFSO.GetFile(FileName)
$ Q4 D+ s. I; U7 ?select Case InfoType
! ^% r1 A! g0 gCase 1 s = f.Datecreated
" p8 U, M: V% |  T- O$ n1 l" BCase 2 s = f.DateLastAccessed
- a: E( }- O9 Q4 g, yCase 3 s = f.DateLastModified 3 d. J5 U, Q4 l0 n. g
Case 4 s = f.Path $ n( W& i5 s+ |# `
Case 5 s = f.Name   V- l, m1 r$ n' N9 k
Case 6 s = f.Type ; h" P' }" ]( x+ Y' s8 W
Case 7 s = f.Size
# P; x9 t* e+ ~# {% a, b) jCase 8 s = f.ParentFolder % L/ y" |3 o. n% _
Case 9 s = f.RootFolder # H" O- g8 `0 H
End select 1 Y  ^  e8 K0 k9 e; f
ShowFileAccessInfo = s
) M- R" C) C- Q/ X9 tELse
% E- A# b  S) P* F/ iShowFileAccessInfo = -1   D6 I, _( B' g7 `- i! s
End if
) d) M% s$ I1 qEnd Function
, w( M+ x; G  E4 s8 I, D3 Y
; u; ~2 I: ^& q; @- F'写文本文件
  j) l4 |% q9 A7 Y9 TPublic Function WriteTxtFile(FileName,TextStr,WriteORAppendType)
7 h9 |, a( ]3 h. b) |Const ForReading = 1, ForWriting = 2 , ForAppending = 8
; c5 `6 M! s( g9 ?( z) nDim f, m $ W' l6 h' ?0 U0 i: c! `7 q
select Case WriteORAppendType ; E& |$ I4 V% T# `
Case 1: '文件进行写操作
" I! B+ V- E% Q0 aSet f = objFSO.OpenTextFile(FileName, ForWriting, True)
6 D! w2 F6 h1 S" Q' A: x/ U$ Yf.Write TextStr & O* P* Q" u4 [# a
f.Close / s0 @0 l0 e, I/ e" S3 h
If ReportFileStatus(FileName) = 1 then
" I* {! F+ p- L: Q. G( M5 _WriteTxtFile = 1 : E) `" p2 U8 B. ], Y
Else
% m% L4 x, W, j9 ZWriteTxtFile = -1
0 W: P5 c9 o7 NEnd if , B" F" L! V3 Y$ e: h- B
Case 2: '文件末尾进行写操作
* V4 S  g: p6 k! G4 [If ReportFileStatus(FileName) = 1 then
. X! }7 G0 ]5 g5 S( u, [Set f = objFSO.OpenTextFile(FileName, ForAppending) . L& |8 k8 }1 |$ b
f.Write TextStr 6 d! d* Y& H) y0 I
f.Close " W: N9 @/ }5 j/ J
WriteTxtFile = 1
  R( ^* [  ]  I' ]: e/ F; J$ r  L9 HElse
0 f/ @" f% ]5 ~% ^WriteTxtFile = -1 " Q0 z7 i0 H9 `: s/ T
End if
* c: I8 u1 N+ |8 i, k# WEnd select
" b( @& y( C  M9 LEnd Function
8 K% \8 e# Y: Z8 o, E
9 K* M$ ~/ p$ U'读文本文件 - x9 T7 t# q: l+ l
Public Function ReadTxtFile(FileName)
  Y: m# i% U6 y% t: WConst ForReading = 1, ForWriting = 2
  A( S( {) m& ^5 M9 b; g) c- RDim f, m ' R! C! q! x) q- `4 d0 k
If ReportFileStatus(FileName) = 1 then ' f* {! K" B; q9 f* S0 e
Set f = objFSO.OpenTextFile(FileName, ForReading)
: j( g9 O6 f, v; l8 ?  H( x8 Zm = f.ReadLine ' v# A; E9 A4 X6 s% G  v# `
ReadTxtFile = m 3 E) D$ J& Y7 I: Z. R- {
f.Close 1 t8 ^9 @! E7 x- m
Else
/ E1 t. ]7 U  a/ f( ], \ReadTxtFile = -1 % g' B' S% e/ M2 a5 U
End if " m- S- k0 W3 s2 u+ B
End Function - K( A% A+ m# S% U- U" G

$ a# B. D$ e0 j2 T'建立文本文件 # d9 e9 N6 J4 r! B- }

# \8 L/ n/ p" w$ K) D5 H'=======目录操作========
; v; z1 {1 m' c. }4 n'取目录大小
* i0 G) w7 c4 x- t$ k+ }8 W) XPublic Function GetFolderSize(FolderName) & g7 h! |& S+ M& g8 `* F- Y0 l
Dim f 4 _2 @/ Z$ X% B8 u( _
If ReportFolderStatus(FolderName) = 1 Then 0 ^+ A: t/ D0 M. V! T" _/ @
Set f = objFSO.GetFolder(FolderName)   v+ V) S" Q2 c
GetFolderSize = f.Size : O9 }/ n. y- B* v
Else
4 o8 J) q% s0 t7 _8 xGetFolderSize = -1 " g3 Z; z1 O. G6 H3 G4 o
End if
" d. V2 g/ q; J2 `. XEnd Function
( u! |2 X; ~3 y& J) Z: A% t8 _; N% c
'创建的文件夹 2 i# _; X9 k. K/ n* G3 \
Public Function createFolderDemo(FolderName)
2 o: n3 E/ P" T* b/ h: o9 qDim f
+ I3 P! [* X8 w2 \/ Y$ SIf ReportFolderStatus(Folderspec) = 1 Then
8 m9 E+ R4 r' P( tcreateFolderDemo = -1
: Y& c3 I. n) D4 o0 H; vElse
1 o; t% x/ U2 R% l& x) kSet f = objFSO.createFolder(FolderName) ' m) B# I3 S, O4 w
createFolderDemo = 1
9 H- v# g) y4 LEnd if
/ c/ D. x8 ?2 A( G" q/ ?End Function , V: e2 H  y1 F) S9 q, l
. h' h9 k6 o0 [, [
'目录删除 1 f% K! X( Z+ y9 \
Public Function deleteAFolder(Folderspec) ' W( x% b4 T" q$ Y: U: }+ [3 n) ?
Response.write Folderspec
( }0 C. t* i1 {5 C5 f  pIf ReportFolderStatus(Folderspec) = 1 Then ; d/ c8 B3 q4 t1 e* ^
objFSO.deleteFolder (Folderspec) : y3 u0 j' r. F% g
deleteAFolder = 1 , \5 \4 P$ h; U9 B  n& T, @# R
Else
0 z# g, b! D+ D* z! AdeleteAFolder = -1
+ M' A$ P/ r( b3 ]  jEnd if
) H, d" @% K0 S1 l& r6 IEnd Function 1 G) ?% o% C+ q0 }4 Z
7 j; ]: i' L/ v/ @; T3 d
'显示目录列表
" _# G7 f$ W, IPublic Function ShowFolderList(FolderSpec) * ~7 I9 Y& M/ ]3 [
Dim f, f1, fc, s ! Z" Q) s9 X0 a( r$ a
If ReportFolderStatus(FolderSpec) = 1 Then , L/ k, L' p& t' V% q4 t( ]+ `
Set f = objFSO.GetFolder(FolderSpec) ) _8 `  {( `( n  Z( C) E
Set fc = f.SubFolders 3 A5 N3 @7 x8 v, o8 E& K& L0 `
For Each f1 in fc . N) ^; A$ ^  F( a; d* M
s = s & f1.name
# [9 t8 f4 O/ ~! F/ f3 _s = s & "|"
: \1 e" j- j- pNext / b0 J5 y* ]* v! E' p
ShowFolderList = s
; s- |! A) S1 G) dElse 8 w/ B  y: @8 k  r3 Y: |
ShowFolderList = -1 / r5 L3 K. i6 g; D9 b
End if
/ O3 `/ r' ?$ _' W  s6 ]% BEnd Function ! {$ j' ^  T) u2 x8 r3 H" M: ~

$ N5 _! R5 A. ]. E4 O' q'目录复制 . h! `) E: n1 z. y( X2 B* P
Public Function CopyAFolder(SourceFolder,DestinationFolder) * s- y7 y4 @/ s9 ?
objFSO.CopyFolder SourceFolder,DestinationFolder
1 h6 K& }) Q' g6 a, xCopyAFolder = 1 7 |" u8 c6 X0 s/ v9 I  E5 j
CopyAFolder = -1
9 C6 V( D' x- K( _End Function
. E; A7 n: o8 n6 R* B
2 B% Z8 L6 W+ F( p' i, H2 j7 \
# ~' X7 ]' i4 F'目录进行移动
+ r6 p8 E( T: P0 T  [1 APublic Function MoveAFolder(SourcePath,DestinationPath)
1 h- m: k# u+ f- A; h8 VIf ReportFolderStatus(SourcePath)=1 And ReportFolderStatus(DestinationPath)=0 Then
8 O8 N# g+ `% @' S. v" l$ b0 PobjFSO.MoveFolder SourcePath, DestinationPath & X1 `  B6 f6 h: s/ [" }9 O% g
MoveAFolder = 1 / Q, K2 Z0 q. {
Else
/ V7 @6 r# K5 B: O9 RMoveAFolder = -1 1 {; r) p4 r- J# S
End if
, i$ _/ E2 D! F0 C2 VEnd Function
8 t' l. i* K4 K7 r- ^2 S3 w
4 ?* G4 f. p# m  |'判断目录是否存在 + @8 f: k3 f; b% Q1 |) f6 M! l
Public Function ReportFolderStatus(fldr) % @7 ]9 [7 J) E* r
Dim msg # h" z6 E2 R' Y2 Q
msg = -1
' `! B3 J5 K# S& K1 W- S4 S6 P$ @If (objFSO.FolderExists(fldr)) Then , S8 U* Z. z; Y  e# \/ Q
msg = 1 5 A1 r8 b3 P8 C# J1 O
Else
# ?# c0 J- f4 I. o; p( emsg = -1
* W1 I7 x/ c7 f6 q, A# F3 O5 |8 ?2 VEnd If / w% d8 g$ f$ ~+ _% J
ReportFolderStatus = msg + b+ A+ \4 s3 B( x4 f( |3 a( i6 l
End Function ; @+ z, S9 [' w* Y

; Q* ^9 T9 A4 A& v6 A' f0 i: D'目录创建时信息
: t. W/ |7 T- O- pPublic Function ShowFolderAccessInfo(FolderName,InfoType)
/ z* l1 I+ |& i) H5 O7 {# y'//功能:显示目录创建时信息
( I! s7 {0 z- u" q, j'//形参:目录名,信息类别
) k9 O" o) j, z" l'// 1 -----创建时间
8 U4 Z" o0 @7 D: k7 E'// 2 -----上次访问时间 7 B. S% ]) h& ?1 y9 v
'// 3 -----上次修改时间 8 O- H- L1 w3 s: w3 l' m0 r
'// 4 -----目录路径 ( O- `% X7 d% M3 v7 O! {
'// 5 -----目录名称 3 ?3 R5 V! ]" B* B' F5 B. j+ r
'// 6 -----目录类型 : _2 A; d7 ?: z# A6 }* M
'// 7 -----目录大小 & C' V/ A# }) H# ~0 ~5 J$ V; g0 y
'// 8 -----父目录
% h* G: c1 ^3 V! V4 s# z8 u'// 9 -----根目录
1 K9 ]# j% h2 CDim f, s
2 Y" N# O0 a7 @4 E2 PIf ReportFolderStatus(FolderName) = 1 then . q- o' X) \* q- e$ r& ], _. N
Set f = objFSO.GetFolder(FolderName) / p6 n' E+ G; y) j
select Case InfoType
# R* A" V# N) ~' A4 wCase 1 s = f.Datecreated
& U/ `0 H0 [4 N3 z  W3 \2 yCase 2 s = f.DateLastAccessed 3 Q- @. F( k+ Y" l( `+ ]
Case 3 s = f.DateLastModified   \4 }" j( ]. c& Q- r
Case 4 s = f.Path . A' v! X7 J! o0 r
Case 5 s = f.Name
. G7 i' ^* v8 _  j% XCase 6 s = f.Type 1 Z4 u% m0 v: c- a3 Y# N
Case 7 s = f.Size
' X4 P7 N. T0 bCase 8 s = f.ParentFolder * r4 T- q* f, G/ `
Case 9 s = f.RootFolder   r7 G, W: U( x: f" p
End select 1 c: z7 p5 h$ v5 z
ShowFolderAccessInfo = s # K$ L2 d. q8 y3 M# @; j4 r  n
ELse 3 c& Z1 J5 V+ m; g- n
ShowFolderAccessInfo = -1 2 z, v! b1 G; y
End if 2 ]$ N% m, J& F3 o- {& `
End Function
5 u' N7 n2 E5 [) D/ F3 @0 e3 Z7 w
'遍历目录
& ?; O; l7 @  w. r" v( r0 u. ZPublic Function DisplayLevelDepth(pathspec) 5 {* b8 f+ z+ n6 X* \6 m) i; ?4 P
Dim f, n ,Path
: x$ f7 J5 S5 u, w7 xSet f = objFSO.GetFolder(pathspec) " `, d- H' \1 P' E7 _2 |" W0 a
If f.IsRootFolder Then
  R6 C8 v0 w) q' ~DisplayLevelDepth ="指定的文件夹是根文件夹。"&RootFolder
, ?% r- F3 d+ x0 o8 Z2 sElse
5 C  }; ~0 r& o* _9 XDo Until f.IsRootFolder
. I, L% F" ^1 u* I. T& P& a  cPath = Path & f.Name &"<br>" 8 ~7 F, N+ o6 V; ^6 x( L
Set f = f.ParentFolder $ o- [% |2 T0 [6 Y% g
n = n + 1 * n* Q' T- N4 D: x; _2 O$ F! K
Loop
6 A; Q0 O  i& L( h7 `' A, tDisplayLevelDepth ="指定的文件夹是嵌套级为 " & n & " 的文件夹。<br>" & Path
! ~, h8 Q, n; N0 x, n  cEnd If : b1 X! F2 E, h/ T8 g' c3 ?1 P
End Function 2 C% V7 \- @1 J! A) d" Y

6 W) v1 z6 g" k6 M'========磁盘操作======== / x8 j8 }* c4 v( L
'驱动器是否存在? / H% F: u  Y& Z" O
Public Function ReportDriveStatus(drv)
3 E+ Z9 v8 |9 oDim msg 8 A7 \  a  g& V; a6 _# f/ a
msg = -1
6 y  K& U5 \/ y" N: `$ X9 {  d) DIf objFSO.DriveExists(drv) Then
$ m& x; l! q2 O) ~msg = 1
1 h! w0 {: b: k* T7 c6 ]Else
. M; Q4 v- F. R" c5 {+ i( Imsg = -1 ( T; J& o3 |2 F5 v
End If
  v( V" Q' z* w" i% e+ QReportDriveStatus = msg
& E" ?5 r- d) u. Q9 o) w1 |- b0 SEnd Function
) U6 x' i/ b! O1 r8 Q% E7 J2 C9 V* q! z0 ^9 y, M' P/ m" a- B
'可用的返回类型包括 FAT、NTFS 和 CDFS。 ( \' T  ~3 a. X
Public Function ShowFileSystemType(drvspec)
# \% |) F- u, N. S+ k+ EDim d 5 Z( ~4 W* Y. q4 B2 i+ H
If ReportDriveStatus(drvspec) = 1 Then 4 m8 c0 I4 D/ T% j' }. R5 P4 a
Set d = objFSO.GetDrive(drvspec) 4 v. c8 y+ y$ T# R# d
ShowFileSystemType = d.FileSystem
8 `; z8 G/ W/ m1 _* nELse / r( ?4 }6 I$ J! t
ShowFileSystemType = -1
3 Z2 R5 k! T9 `2 O4 h/ j& rEnd if
. y# g' y0 U) y6 h* N. h9 x9 VEnd Function ) K) i' }4 \' A' l( I4 S
End Class ' e: t7 f& C) O) `
%>




欢迎光临 【高州情】高州人深圳站 (https://0668qq.cn/) Powered by Discuz! X2