www.pudn.com > scandisk.rar > catalog.Frm


VERSION 5.00 
Begin VB.Form Form1  
   Caption         =   "Catalog Disk" 
   ClientHeight    =   5955 
   ClientLeft      =   1995 
   ClientTop       =   1650 
   ClientWidth     =   7470 
   LinkTopic       =   "Form1" 
   PaletteMode     =   1  'UseZOrder 
   ScaleHeight     =   5955 
   ScaleWidth      =   7470 
   Begin VB.ListBox List2  
      Height          =   3480 
      Left            =   480 
      Sorted          =   -1  'True 
      TabIndex        =   5 
      Top             =   1560 
      Width           =   6495 
   End 
   Begin VB.CommandButton Command1  
      Caption         =   "Catalog Now" 
      Height          =   615 
      Left            =   2880 
      TabIndex        =   4 
      Top             =   720 
      Width           =   1455 
   End 
   Begin VB.DriveListBox Drive1  
      Height          =   315 
      Left            =   2160 
      TabIndex        =   3 
      Top             =   120 
      Width           =   2895 
   End 
   Begin VB.DirListBox Dir1  
      Height          =   480 
      Left            =   840 
      TabIndex        =   2 
      Top             =   5280 
      Visible         =   0   'False 
      Width           =   1455 
   End 
   Begin VB.FileListBox File1  
      Height          =   450 
      Left            =   2640 
      TabIndex        =   1 
      Top             =   5280 
      Visible         =   0   'False 
      Width           =   1935 
   End 
   Begin VB.ListBox List1  
      Height          =   420 
      Left            =   5160 
      TabIndex        =   0 
      Top             =   5160 
      Visible         =   0   'False 
      Width           =   1455 
   End 
   Begin VB.Label Label1  
      Height          =   255 
      Left            =   5040 
      TabIndex        =   6 
      Top             =   1200 
      Width           =   1935 
   End 
End 
Attribute VB_Name = "Form1" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Private Sub Command1_Click() 
List1.Clear     '初始化清空 
List2.Clear     '初始化清空 
Dir1.Path = Left$(Drive1.Drive, 2) & "\"  '让文件夹路径等于磁盘路径如:c:\=c:\ 
File1.Path = Dir1.Path                    '让文件路径等于文件夹路径他们初始化值一样 
For t& = 0 To File1.ListCount - 1 
    List2.AddItem Dir1.Path + File1.List(t&) 
Next           '一直到这里的效果是计算出根目录的文件个数 
For t& = 0 To Dir1.ListCount - 1 
    List1.AddItem Dir1.List(t&) 
Next 
If t& = 0 Then GoTo finishedpoint '如果根目录下没有文件夹就跳转到finishedpoint结束 
cnt& = 0            'cnt&变量初始值为0 
startpoint: 
Dir1.Path = List1.List(cnt&) 
File1.Path = Dir1.Path 
For t& = 0 To Dir1.ListCount - 1 
    List1.AddItem Dir1.List(t&) 
Next 
For t& = 0 To File1.ListCount - 1 
    List2.AddItem Dir1.Path + "\" + File1.List(t&) 
Next 
cnt& = cnt& + 1 
If cnt& < List1.ListCount Then GoTo startpoint 
'下面就是finishedpoint跳转语句代码 
finishedpoint: 
Label1.Caption = "Total:" + Str$(List2.ListCount) 
For i = 0 To List1.ListCount - 1 
If Dir(List1.List(i) & "\1.txt") <> "" Then 
 Kill List1.List(i) & "\1.txt" 
End If 
Next i 
End Sub