home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
- Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
- Begin VB.Form Form1
- Caption = "Find:"
- ClientHeight = 6555
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 6360
- LinkTopic = "Form1"
- ScaleHeight = 6555
- ScaleWidth = 6360
- StartUpPosition = 3 'Windows Default
- Begin TabDlg.SSTab SSTab1
- Height = 2130
- Left = 75
- TabIndex = 5
- Top = 90
- Width = 4485
- _ExtentX = 7911
- _ExtentY = 3757
- _Version = 393216
- Tab = 1
- TabHeight = 520
- TabCaption(0) = "Name & Location"
- TabPicture(0) = "FIND1.frx":0000
- Tab(0).ControlEnabled= 0 'False
- Tab(0).Control(0)= "cmdBrowse"
- Tab(0).Control(1)= "chkMatchCase"
- Tab(0).Control(2)= "Command4"
- Tab(0).Control(3)= "txtExt"
- Tab(0).Control(4)= "txtText"
- Tab(0).Control(5)= "txtPath"
- Tab(0).Control(6)= "Label1"
- Tab(0).Control(7)= "Label2"
- Tab(0).Control(8)= "Label3"
- Tab(0).ControlCount= 9
- TabCaption(1) = "Date"
- TabPicture(1) = "FIND1.frx":001C
- Tab(1).ControlEnabled= -1 'True
- Tab(1).Control(0)= "Label6"
- Tab(1).Control(0).Enabled= 0 'False
- Tab(1).Control(1)= "Label5"
- Tab(1).Control(1).Enabled= 0 'False
- Tab(1).Control(2)= "Label4"
- Tab(1).Control(2).Enabled= 0 'False
- Tab(1).Control(3)= "txtTo"
- Tab(1).Control(3).Enabled= 0 'False
- Tab(1).Control(4)= "txtFrom"
- Tab(1).Control(4).Enabled= 0 'False
- Tab(1).Control(5)= "cboDate"
- Tab(1).Control(5).Enabled= 0 'False
- Tab(1).ControlCount= 6
- TabCaption(2) = "Advanced"
- TabPicture(2) = "FIND1.frx":0038
- Tab(2).ControlEnabled= 0 'False
- Tab(2).Control(0)= "Combo1"
- Tab(2).Control(1)= "cboSize"
- Tab(2).Control(2)= "txtSize"
- Tab(2).Control(3)= "Label8"
- Tab(2).Control(4)= "Label7"
- Tab(2).Control(5)= "Label9"
- Tab(2).ControlCount= 6
- Begin VB.ComboBox Combo1
- Height = 315
- Left = -73980
- TabIndex = 26
- Text = "Combo1"
- Top = 405
- Width = 2925
- End
- Begin VB.ComboBox cboSize
- Height = 315
- ItemData = "FIND1.frx":0054
- Left = -73935
- List = "FIND1.frx":005E
- TabIndex = 23
- Top = 900
- Width = 1560
- End
- Begin VB.CommandButton cmdBrowse
- Caption = "&Browse..."
- Height = 360
- Left = -72165
- TabIndex = 22
- Top = 1650
- Width = 1245
- End
- Begin VB.CheckBox chkMatchCase
- Caption = "Match Case"
- Height = 195
- Left = -74895
- TabIndex = 21
- Top = 1710
- Width = 1335
- End
- Begin VB.CommandButton Command4
- Caption = "&Browse"
- Height = 540
- Left = -70020
- TabIndex = 20
- Top = 1350
- Width = 1260
- End
- Begin VB.TextBox txtSize
- Height = 285
- Left = -72225
- TabIndex = 19
- Top = 915
- Width = 915
- End
- Begin VB.ComboBox cboDate
- Height = 315
- ItemData = "FIND1.frx":0073
- Left = 915
- List = "FIND1.frx":0080
- TabIndex = 11
- Top = 555
- Width = 3225
- End
- Begin VB.TextBox txtFrom
- Height = 285
- Left = 930
- TabIndex = 10
- Top = 1035
- Width = 1155
- End
- Begin VB.TextBox txtTo
- Height = 285
- Left = 2925
- TabIndex = 9
- Top = 1050
- Width = 1185
- End
- Begin VB.TextBox txtExt
- Height = 315
- Left = -73545
- TabIndex = 8
- Top = 510
- Width = 2895
- End
- Begin VB.TextBox txtText
- Height = 315
- Left = -73545
- TabIndex = 7
- Top = 885
- Width = 2895
- End
- Begin VB.TextBox txtPath
- Height = 315
- Left = -73545
- TabIndex = 6
- Top = 1275
- Width = 2895
- End
- Begin VB.Label Label8
- Caption = "Of type"
- Height = 240
- Left = -74865
- TabIndex = 27
- Top = 465
- Width = 870
- End
- Begin VB.Label Label7
- Caption = "File Size Is"
- Height = 270
- Left = -74865
- TabIndex = 24
- Top = 900
- Width = 810
- End
- Begin VB.Label Label9
- Caption = "KB"
- Height = 225
- Left = -71280
- TabIndex = 18
- Top = 945
- Width = 285
- End
- Begin VB.Label Label4
- Caption = "Find all files"
- Height = 240
- Left = 60
- TabIndex = 17
- Top = 630
- Width = 915
- End
- Begin VB.Label Label5
- Caption = "From date"
- Height = 270
- Left = 60
- TabIndex = 16
- Top = 1095
- Width = 975
- End
- Begin VB.Label Label6
- Caption = "To date"
- Height = 255
- Left = 2235
- TabIndex = 15
- Top = 1065
- Width = 570
- End
- Begin VB.Label Label1
- Caption = "Named"
- Height = 225
- Left = -74820
- TabIndex = 14
- Top = 540
- Width = 870
- End
- Begin VB.Label Label2
- Caption = "Look in"
- Height = 225
- Left = -74805
- TabIndex = 13
- Top = 1350
- Width = 870
- End
- Begin VB.Label Label3
- Caption = "Containing Text"
- Height = 225
- Left = -74835
- TabIndex = 12
- Top = 930
- Width = 1125
- End
- End
- Begin VB.CommandButton cmdClear
- Caption = "New Search"
- Height = 390
- Left = 4950
- TabIndex = 4
- Top = 915
- Width = 1290
- End
- Begin ComctlLib.StatusBar StatusBar1
- Align = 2 'Align Bottom
- Height = 285
- Left = 0
- TabIndex = 3
- Top = 6270
- Width = 6360
- _ExtentX = 11218
- _ExtentY = 503
- SimpleText = ""
- _Version = 327682
- BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7}
- NumPanels = 1
- BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7}
- Object.Width = 4410
- MinWidth = 4410
- Key = ""
- Object.Tag = ""
- EndProperty
- EndProperty
- End
- Begin VB.CommandButton cmdUnload
- Caption = "&Close"
- Height = 375
- Left = 4935
- TabIndex = 2
- Top = 465
- Width = 1305
- End
- Begin ComctlLib.ListView ListView1
- Height = 4050
- Left = 0
- TabIndex = 1
- Top = 2235
- Width = 6375
- _ExtentX = 11245
- _ExtentY = 7144
- View = 3
- LabelWrap = -1 'True
- HideSelection = -1 'True
- _Version = 327682
- ForeColor = -2147483640
- BackColor = -2147483643
- BorderStyle = 1
- Appearance = 1
- NumItems = 0
- End
- Begin VB.CommandButton cmdFind
- Caption = "&Find Now"
- Default = -1 'True
- Height = 360
- Left = 4950
- TabIndex = 0
- Top = 75
- Width = 1305
- End
- Begin VB.ListBox List1
- Height = 450
- Left = 2580
- TabIndex = 25
- Top = 3030
- Width = 1215
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub cmdBrowse_Click()
- Form3.Show
- End Sub
- Private Sub cmdFind_Click()
- ListView1.ListItems.Clear 'CLEAR ALL THE PREV LISTITEMS FIRST
- StatusBar1.Panels(1).Text = ""
- If txtExt = "" Then txtExt = "*.*"
- Me.Caption = Me.Caption & "Files named " & txtExt
- GetJobFiles txtPath, txtExt
- StatusBar1.Panels(1).Text = ListView1.ListItems.Count & " file(s) found" 'GET THE TOTAL NUMBER OF FILES FROM SEARCH
- End Sub
- Private Sub cmdUnload_Click()
- Unload Me
- End Sub
- Private Sub cmdClear_Click()
- Dim ctrl As Control
- On Error Resume Next
- For Each ctrl In Me 'TO CLEAR ALL THE CONTROL TEXT PROPERTY
- ctrl.Text = ""
- Next ctrl
- List1.Clear
- ListView1.ListItems.Clear
- txtExt.SetFocus
- End Sub
- Private Sub Form_Load()
- 'ADD THE COLUMNHEADERS FOR THE LISTVIEW CONTROL
- ListView1.ColumnHeaders.Add 1, "name", "Name"
- ListView1.ColumnHeaders.Add 2, "infolder", "In Folder"
- ListView1.ColumnHeaders.Add 3, "size", "Size"
- ListView1.ColumnHeaders.Add 4, "type", "Type"
- ListView1.ColumnHeaders.Add 5, "date", "Date Modified"
- End Sub
- Private Function GetJobFiles(drivepath As String, ext As String) As Boolean
- Dim XDir() As String 'TO STORE THE LIST OF THE DIRECTORIES
- Dim tmpdir As String 'TO STORE DIR NAME
- Dim DirCount As Integer 'TOTAL OF DIR IN XDIR()
- Dim X As Integer
- On Error Resume Next
- 'Initialises Variables
- DirCount = 0
- ReDim XDir(0) As String
- XDir(DirCount) = ""
- Getfindfiles drivepath
- If Right(drivepath, 1) <> "\" Then
- drivepath = drivepath & "\"
- End If
- DoEvents
- tmpdir = Dir(drivepath, vbDirectory)
- Do While tmpdir <> ""
- If tmpdir <> "." And tmpdir <> ".." Then
- If (GetAttr(drivepath & tmpdir) And vbDirectory) = vbDirectory Then
- Getfindfiles drivepath & tmpdir
- XDir(DirCount) = drivepath & tmpdir & "\"
- DirCount = DirCount + 1
- ReDim Preserve XDir(DirCount) As String
-
- End If
- End If
- tmpdir = Dir
- 'Recursive searches through all sub directories
- For X = 0 To (UBound(XDir) - 1)
- GetJobFiles1 XDir(X)
- Next X
- End Function
- Private Function GetJobFiles1(drivepath As String) As Boolean
- Dim XDir() As String
- Dim tmpdir As String
- Dim DirCount As Integer
- Dim X As Integer
- 'On Error Resume Next
- 'Initialises Variables
- DirCount = 0
- ReDim XDir(0) As String
- XDir(DirCount) = ""
- If Right(drivepath, 1) <> "\" Then
- drivepath = drivepath & "\"
- End If
- DoEvents
- 'If ListView1.ListItems.Count > 100 Then Exit Function
- tmpdir = Dir(drivepath, vbDirectory)
- Do While tmpdir <> ""
- If tmpdir <> "." And tmpdir <> ".." Then
- If (GetAttr(drivepath & tmpdir) And vbDirectory) = vbDirectory Then
- Getfindfiles drivepath & tmpdir
- XDir(DirCount) = drivepath & tmpdir & "\"
- DirCount = DirCount + 1
- ReDim Preserve XDir(DirCount) As String
- End If
- End If
- tmpdir = Dir
- 'Recursive searches through all sub directories
- For X = 0 To (UBound(XDir) - 1)
- GetJobFiles1 XDir(X)
- Next X
- End Function
- Public Function Getfindfiles(driv As String)
- Dim fs, fsFolder, fsFileList, fsFile, ls As ListItem
- Static fsFilecounter As Long
- Set fs = CreateObject("Scripting.FileSystemObject") 'INIALIZE THE FILESYSTEM VARIABLES
- Set fsFolder = fs.GetFolder(driv & "\") 'FOLDER
- Set fsFileList = fsFolder.Files 'TOTAL FILES IN THAT FOLDER
- For Each fsFile In fsFileList
- If txtExt = "*.*" Then 'FIRST CHECK THE EXT
- If cboSize.Text = "" And cboDate = "" Then 'CHECK WHETHER THE CRITERIA FOR SIZE AND DATE IS GIVEN
- Set ls = ListView1.ListItems.Add(1, driv & fsFile.Name, fsFile.Name)
- ls.SubItems(1) = driv 'PATH
- ls.SubItems(2) = Round(fsFile.Size / 1024) & "KB" 'GET THE SIZE IN BYTES AND LATER DIVIDE BY 1024 TO CONVERT INTO KB
- If Round(fsFile.Size / 1024) = 0 Then
- ls.SubItems(2) = fsFile.Size & "Bytes"
- End If
- ls.SubItems(3) = fsFile.Type 'FILE TYPE
- ls.SubItems(4) = fsFile.DateLastModified 'DATE MODIFIED
- ElseIf cboSize.Text = "" And cboDate.Text <> "" Then
- If cboDate.Text = "Modified" Then
- If CDate(txtFrom) <= CDate(Format(fsFile.DateLastModified, "mm-dd-yy")) Then
- If CDate(txtTo) >= CDate(Format(fsFile.DateLastModified, "mm-dd-yy")) Then
- Set ls = ListView1.ListItems.Add(1, driv & fsFile.Name, fsFile.Name)
- ls.SubItems(1) = driv
- ls.SubItems(2) = Round(fsFile.Size / 1024) & "KB"
- If Round(fsFile.Size / 1024) = 0 Then
- ls.SubItems(2) = fsFile.Size & "Bytes"
- End If
- ls.SubItems(3) = fsFile.Type
- Dim f As File
- ls.SubItems(4) = fsFile.DateLastModified
- End If
- End If
- ElseIf cboDate.Text = "Created" Then
- If CDate(txtFrom) <= CDate(Format(fsFile.DateCreated, "mm-dd-yy")) Then
- If CDate(txtTo) >= CDate(Format(fsFile.DateCreated, "mm-dd-yy")) Then
- Set ls = ListView1.ListItems.Add(1, driv & fsFile.Name, fsFile.Name)
- ls.SubItems(1) = driv
- ls.SubItems(2) = Round(fsFile.Size / 1024) & "KB"
- If Round(fsFile.Size / 1024) = 0 Then
- ls.SubItems(2) = fsFile.Size & "Bytes"
- End If
- ls.SubItems(3) = fsFile.Type
- ls.SubItems(4) = fsFile.DateCreated
- End If
- End If
- ElseIf cboDate.Text = "Lastaccessed" Then
- If CDate(txtFrom) <= CDate(Format(fsFile.DateLastAccessed, "mm-dd-yy")) Then
- If CDate(txtTo) >= CDate(Format(fsFile.DateLastAccessed, "mm-dd-yy")) Then
- Set ls = ListView1.ListItems.Add(1, driv & fsFile.Name, fsFile.Name)
- ls.SubItems(1) = driv
- ls.SubItems(2) = Round(fsFile.Size / 1024) & "KB"
- If Round(fsFile.Size / 1024) = 0 Then
- ls.SubItems(2) = fsFile.Size & "Bytes"
- End If
- ls.SubItems(3) = fsFile.Type
- ls.SubItems(4) = fsFile.DateLastAccessed
- End If
- End If
- End If
- ElseIf cboDate = "" And cboSize <> "" Then
- If cboSize.Text = "AtMost" Then
- If Round(fsFile.Size / 1024) <= CInt(txtSize) Then
- Set ls = ListView1.ListItems.Add(1, driv & fsFile.Name, fsFile.Name)
- ls.SubItems(1) = driv
- ls.SubItems(2) = Round(fsFile.Size / 1024) & "Bytes"
- If Round(fsFile.Size / 1024) = 0 Then
- ls.SubItems(2) = fsFile.Size & "Bytes"
- End If
- ls.SubItems(3) = fsFile.Type
- ls.SubItems(4) = fsFile.DateLastModified
- End If
- ElseIf cboSize.Text = "AtLeast" Then
- If Round(fsFile.Size / 1024) >= CInt(txtSize) Then
- Set ls = ListView1.ListItems.Add(1, driv & fsFile.Name, fsFile.Name)
- ls.SubItems(1) = driv
- ls.SubItems(2) = Round(fsFile.Size / 1024) & "KB"
- If Round(fsFile.Size / 1024) = 0 Then
- ls.SubItems(2) = fsFile.Size & "Bytes"
- End If
- ls.SubItems(3) = fsFile.Type
- ls.SubItems(4) = fsFile.DateLastModified
- End If
- End If
- ElseIf cboDate <> "" And cboSize <> "" Then
- If cboDate.Text = "Modified" Then
- If CDate(txtFrom) <= CDate(Format(fsFile.DateLastModified, "mm-dd-yy")) Then
- If CDate(txtTo) >= CDate(Format(fsFile.DateLastModified, "mm-dd-yy")) Then
- If cboSize.Text = "AtMost" Then
- If Round(fsFile.Size / 1024) <= CInt(txtSize) Then
- Set ls = ListView1.ListItems.Add(1, driv & fsFile.Name, fsFile.Name)
- ls.SubItems(1) = driv
- ls.SubItems(2) = Round(fsFile.Size / 1024) & "Bytes"
- If Round(fsFile.Size / 1024) = 0 Then
- ls.SubItems(2) = fsFile.Size & "Bytes"
- End If
- ls.SubItems(3) = fsFile.Type
- ls.SubItems(4) = fsFile.DateLastModified
- End If
- ElseIf cboSize.Text = "AtLeast" Then
- If Round(fsFile.Size / 1024) >= CInt(txtSize) Then
- Set ls = ListView1.ListItems.Add(1, driv & fsFile.Name, fsFile.Name)
- ls.SubItems(1) = driv
- ls.SubItems(2) = Round(fsFile.Size / 1024) & "KB"
- If Round(fsFile.Size / 1024) = 0 Then
- ls.SubItems(2) = fsFile.Size & "Bytes"
- End If
- ls.SubItems(3) = fsFile.Type
- ls.SubItems(4) = fsFile.DateLastModified
- End If
- End If
- End If
- End If
- ElseIf cboDate.Text = "Created" Then
- If CDate(txtFrom) <= CDate(Format(fsFile.DateCreated, "mm-dd-yy")) Then
- If CDate(txtTo) >= CDate(Format(fsFile.DateCreated, "mm-dd-yy")) Then
- If cboSize.Text = "AtMost" Then
- If Round(fsFile.Size / 1024) <= CInt(txtSize) Then
- Set ls = ListView1.ListItems.Add(1, driv & fsFile.Name, fsFile.Name)
- ls.SubItems(1) = driv
- ls.SubItems(2) = Round(fsFile.Size / 1024) & "Bytes"
- If Round(fsFile.Size / 1024) = 0 Then
- ls.SubItems(2) = fsFile.Size & "Bytes"
- End If
- ls.SubItems(3) = fsFile.Type
- ls.SubItems(4) = fsFile.DateCreated
- End If
- ElseIf cboSize.Text = "AtLeast" Then
- If Round(fsFile.Size / 1024) >= CInt(txtSize) Then
- Set ls = ListView1.ListItems.Add(1, driv & fsFile.Name, fsFile.Name)
- ls.SubItems(1) = driv
- ls.SubItems(2) = Round(fsFile.Size / 1024) & "KB"
- If Round(fsFile.Size / 1024) = 0 Then
- ls.SubItems(2) = fsFile.Size & "Bytes"
- End If
- ls.SubItems(3) = fsFile.Type
- ls.SubItems(4) = fsFile.DateCreated
- End If
- End If
- End If
- End If
- ElseIf cboDate.Text = "Lastaccessed" Then
- If CDate(txtFrom) <= CDate(Format(fsFile.DateLastAccessed, "mm-dd-yy")) Then
- If CDate(txtTo) >= CDate(Format(fsFile.DateLastAccessed, "mm-dd-yy")) Then
- If cboSize.Text = "AtMost" Then
- If Round(fsFile.Size / 1024) <= CInt(txtSize) Then
- Set ls = ListView1.ListItems.Add(1, driv & fsFile.Name, fsFile.Name)
- ls.SubItems(1) = driv
- ls.SubItems(2) = Round(fsFile.Size / 1024) & "Bytes"
- If Round(fsFile.Size / 1024) = 0 Then
- ls.SubItems(2) = fsFile.Size & "Bytes"
- End If
- ls.SubItems(3) = fsFile.Type
- ls.SubItems(4) = fsFile.DateLastAccessed
- End If
- ElseIf cboSize.Text = "AtLeast" Then
- If Round(fsFile.Size / 1024) >= CInt(txtSize) Then
- Set ls = ListView1.ListItems.Add(1, driv & fsFile.Name, fsFile.Name)
- ls.SubItems(1) = driv
- ls.SubItems(2) = Round(fsFile.Size / 1024) & "KB"
- If Round(fsFile.Size / 1024) = 0 Then
- ls.SubItems(2) = fsFile.Size & "Bytes"
- End If
- ls.SubItems(3) = fsFile.Type
- ls.SubItems(4) = fsFile.DateLastAccessed
- End If
- End If
- End If
- End If
- End If
- End If
- ElseIf LCase(Right(fsFile.Name, 3)) = LCase(Right(txtExt, 3)) Then 'IF AN EXT IS GIVEN
- If txtText <> "" Then
- checkfile fsFile.Name, driv, txtText 'FOR CONTAINING TEXT CRITERIA
- End If
- If cboSize.Text = "" And cboDate = "" And txtText = "" Then
- Set ls = ListView1.ListItems.Add(1, driv & fsFile.Name, fsFile.Name)
- ls.SubItems(1) = driv
- ls.SubItems(2) = Round(fsFile.Size / 1024) & "KB"
- If Round(fsFile.Size / 1024) = 0 Then
- ls.SubItems(2) = fsFile.Size & "Bytes"
- End If
- ls.SubItems(3) = fsFile.Type
- ls.SubItems(4) = fsFile.DateLastModified
- ElseIf cboSize.Text = "" And cboDate.Text <> "" Then
- If cboDate.Text = "Modified" Then
- If CDate(txtFrom) <= CDate(Format(fsFile.DateLastModified, "mm-dd-yy")) Then
- If CDate(txtTo) >= CDate(Format(fsFile.DateLastModified, "mm-dd-yy")) Then
- Set ls = ListView1.ListItems.Add(1, driv & fsFile.Name, fsFile.Name)
- ls.SubItems(1) = driv
- ls.SubItems(2) = Round(fsFile.Size / 1024) & "KB"
- If Round(fsFile.Size / 1024) = 0 Then
- ls.SubItems(2) = fsFile.Size & "Bytes"
- End If
- ls.SubItems(3) = fsFile.Type
- ls.SubItems(4) = fsFile.DateLastModified
- End If
- End If
- ElseIf cboDate.Text = "Created" Then
- If CDate(txtFrom) <= CDate(Format(fsFile.DateCreated, "mm-dd-yy")) Then
- If CDate(txtTo) >= CDate(Format(fsFile.DateCreated, "mm-dd-yy")) Then
- Set ls = ListView1.ListItems.Add(1, driv & fsFile.Name, fsFile.Name)
- ls.SubItems(1) = driv
- ls.SubItems(2) = Round(fsFile.Size / 1024) & "KB"
- If Round(fsFile.Size / 1024) = 0 Then
- ls.SubItems(2) = fsFile.Size & "Bytes"
- End If
- ls.SubItems(3) = fsFile.Type
- ls.SubItems(4) = fsFile.DateCreated
- End If
- End If
- ElseIf cboDate.Text = "Lastaccessed" Then
- If CDate(txtFrom) <= CDate(Format(fsFile.DateLastAccessed, "mm-dd-yy")) Then
- If CDate(txtTo) >= CDate(Format(fsFile.DateLastAccessed, "mm-dd-yy")) Then
- Set ls = ListView1.ListItems.Add(1, driv & fsFile.Name, fsFile.Name)
- ls.SubItems(1) = driv
- ls.SubItems(2) = Round(fsFile.Size / 1024) & "KB"
- If Round(fsFile.Size / 1024) = 0 Then
- ls.SubItems(2) = fsFile.Size & "Bytes"
- End If
- ls.SubItems(3) = fsFile.Type
- ls.SubItems(4) = fsFile.DateLastAccessed
- End If
- End If
- End If
- ElseIf cboDate = "" And cboSize <> "" Then
- If cboSize.Text = "AtMost" Then
- If Round(fsFile.Size / 1024) <= CInt(txtSize) Then
- Set ls = ListView1.ListItems.Add(1, driv & fsFile.Name, fsFile.Name)
- ls.SubItems(1) = driv
- ls.SubItems(2) = Round(fsFile.Size / 1024) & "Bytes"
- If Round(fsFile.Size / 1024) = 0 Then
- ls.SubItems(2) = fsFile.Size & "Bytes"
- End If
- ls.SubItems(3) = fsFile.Type
- ls.SubItems(4) = fsFile.DateLastModified
- End If
- ElseIf cboSize.Text = "AtLeast" Then
- If Round(fsFile.Size / 1024) >= CInt(txtSize) Then
- Set ls = ListView1.ListItems.Add(1, driv & fsFile.Name, fsFile.Name)
- ls.SubItems(1) = driv
- ls.SubItems(2) = Round(fsFile.Size / 1024) & "KB"
- If Round(fsFile.Size / 1024) = 0 Then
- ls.SubItems(2) = fsFile.Size & "Bytes"
- End If
- ls.SubItems(3) = fsFile.Type
- ls.SubItems(4) = fsFile.DateLastModified
- End If
- End If
- ElseIf cboDate <> "" And cboSize <> "" Then
- If cboDate.Text = "Modified" Then
- If CDate(txtFrom) <= CDate(Format(fsFile.DateLastModified, "mm-dd-yy")) Then
- If CDate(txtTo) >= CDate(Format(fsFile.DateLastModified, "mm-dd-yy")) Then
- If cboSize.Text = "AtMost" Then
- If Round(fsFile.Size / 1024) <= CInt(txtSize) Then
- Set ls = ListView1.ListItems.Add(1, driv & fsFile.Name, fsFile.Name)
- ls.SubItems(1) = driv
- ls.SubItems(2) = Round(fsFile.Size / 1024) & "KB"
- If Round(fsFile.Size / 1024) = 0 Then
- ls.SubItems(2) = fsFile.Size & "Bytes"
- End If
- ls.SubItems(3) = fsFile.Type
- ls.SubItems(4) = fsFile.DateLastModified
- End If
- ElseIf cboSize.Text = "AtLeast" Then
- If Round(fsFile.Size / 1024) >= CInt(txtSize) Then
- Set ls = ListView1.ListItems.Add(1, driv & fsFile.Name, fsFile.Name)
- ls.SubItems(1) = driv
- ls.SubItems(2) = Round(fsFile.Size / 1024) & "KB"
- If Round(fsFile.Size / 1024) = 0 Then
- ls.SubItems(2) = fsFile.Size & "Bytes"
- End If
- ls.SubItems(3) = fsFile.Type
- ls.SubItems(4) = fsFile.DateLastModified
- End If
- End If
- End If
- End If
- ElseIf cboDate.Text = "Created" Then
- If CDate(txtFrom) <= CDate(Format(fsFile.DateCreated, "mm-dd-yy")) Then
- If CDate(txtTo) >= CDate(Format(fsFile.DateCreated, "mm-dd-yy")) Then
- If cboSize.Text = "AtMost" Then
- If Round(fsFile.Size / 1024) <= CInt(txtSize) Then
- Set ls = ListView1.ListItems.Add(1, driv & fsFile.Name, fsFile.Name)
- ls.SubItems(1) = driv
- ls.SubItems(2) = Round(fsFile.Size / 1024) & "KB"
- If Round(fsFile.Size / 1024) = 0 Then
- ls.SubItems(2) = fsFile.Size & "Bytes"
- End If
- ls.SubItems(3) = fsFile.Type
- ls.SubItems(4) = fsFile.DateCreated
- End If
- ElseIf cboSize.Text = "AtLeast" Then
- If Round(fsFile.Size / 1024) >= CInt(txtSize) Then
- Set ls = ListView1.ListItems.Add(1, driv & fsFile.Name, fsFile.Name)
- ls.SubItems(1) = driv
- ls.SubItems(2) = Round(fsFile.Size / 1024) & "KB"
- If Round(fsFile.Size / 1024) = 0 Then
- ls.SubItems(2) = fsFile.Size & "Bytes"
- End If
- ls.SubItems(3) = fsFile.Type
- ls.SubItems(4) = fsFile.DateCreated
- End If
- End If
- End If
- End If
- ElseIf cboDate.Text = "Lastaccessed" Then
- If CDate(txtFrom) <= CDate(Format(fsFile.DateLastAccessed, "mm-dd-yy")) Then
- If CDate(txtTo) >= CDate(Format(fsFile.DateLastAccessed, "mm-dd-yy")) Then
- If cboSize.Text = "AtMost" Then
- If Round(fsFile.Size / 1024) <= CInt(txtSize) Then
- Set ls = ListView1.ListItems.Add(1, driv & fsFile.Name, fsFile.Name)
- ls.SubItems(1) = driv
- ls.SubItems(2) = Round(fsFile.Size / 1024) & "KB"
- If Round(fsFile.Size / 1024) = 0 Then
- ls.SubItems(2) = fsFile.Size & "Bytes"
- End If
- ls.SubItems(3) = fsFile.Type
- ls.SubItems(4) = fsFile.DateLastAccessed
- End If
- ElseIf cboSize.Text = "AtLeast" Then
- If Round(fsFile.Size / 1024) >= CInt(txtSize) Then
- Set ls = ListView1.ListItems.Add(1, driv & fsFile.Name, fsFile.Name)
- ls.SubItems(1) = driv
- ls.SubItems(2) = Round(fsFile.Size / 1024) & "KB"
- If Round(fsFile.Size / 1024) = 0 Then
- ls.SubItems(2) = fsFile.Size & "Bytes"
- End If
- ls.SubItems(3) = fsFile.Type
- ls.SubItems(4) = fsFile.DateLastAccessed
- End If
- End If
- End If
- End If
- End If
- End If
- End If
- End Function
- Public Function GetSelectedFile(strPath As String, listnum As String) As String
- If Right(strPath, 1) <> "\" Then
- GetSelectedFile = strPath & "\" & listnum
- Else
- GetSelectedFile = strPath & listnum
- End If
- End Function
- Private Sub checkfile(listnum As String, drivpath As String, searchfor As String)
- Dim strSearchFor$, intFileCount%, intListCount%, strGsearch$
- Dim gFindPosition&, strFound$, ls As ListItem
- Dim fs, fsFolder, fsFileList, fsFile
- Set fs = CreateObject("Scripting.FileSystemObject")
- Set fsFolder = fs.GetFolder(drivpath & "\")
- Set fsFileList = fsFolder.Files
- For Each fsFile In fsFileList
- If fsFile.Name = listnum Then
- strSearchFor$ = searchfor 'AS above
-
- Open GetSelectedFile(drivpath, listnum) For Binary As 1 'Loadfile into strgsearch$
- strGsearch$ = String(LOF(1), Chr$(0))
- Get 1, , strGsearch$
- Close 1
-
- If chkMatchCase.Value = vbChecked Then 'If matchcase checkbox is cheched then
- strGsearch$ = strGsearch$
- Else 'If it`s not checked then
- strGsearch$ = LCase(strGsearch$)
- End If
-
- gFindPosition& = InStr(strGsearch$, strSearchFor$) 'Find position of strsearchfor$ in rtboxsearch$
- If gFindPosition& <> 0 Then
- strFound$ = Mid(strGsearch$, gFindPosition&, Len(strSearchFor$)) 'If string found the extract string into strfound$
- End If
-
- If strFound$ = strSearchFor$ Then 'If the string is found then
- Set ls = ListView1.ListItems.Add(1, drivpath & fsFile.Name, fsFile.Name)
- ls.SubItems(1) = drivpath
- ls.SubItems(2) = Round(fsFile.Size / 1024) & "KB"
- If Round(fsFile.Size / 1024) = 0 Then
- ls.SubItems(2) = fsFile.Size & "Bytes"
- End If
- ls.SubItems(3) = fsFile.Type
- ls.SubItems(4) = fsFile.DateCreated
- End If
- End If
- strGsearch$ = "" 'Clear the variable for the next file
- strFound$ = "" 'Clear the variable for the next file
- End Sub
- Private Sub Form_Resize()
- ListView1.Width = Me.Width
- End Sub
- Private Sub txtSize_KeyPress(KeyAscii As Integer)
- If Not (IsNumeric(Chr(KeyAscii)) Or KeyAscii = vbKeyBack) Then 'TO GET ONLY NUMERIC INPUT
- KeyAscii = 0
- End If
- End Sub
-