home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.1#0"; "RICHTX32.OCX"
- Begin VB.Form DirMapForm
- Caption = "Directory Map"
- ClientHeight = 5625
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 8250
- LinkTopic = "Form1"
- ScaleHeight = 5625
- ScaleWidth = 8250
- StartUpPosition = 3 'Windows Default
- Begin VB.DriveListBox Drive1
- BeginProperty Font
- Name = "Verdana"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 315
- Left = 75
- TabIndex = 4
- Top = 105
- Width = 2430
- End
- Begin VB.DirListBox Dir1
- BeginProperty Font
- Name = "Verdana"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 1215
- Left = 2745
- TabIndex = 3
- Top = 120
- Width = 2925
- End
- Begin VB.CommandButton Command1
- Caption = "Map this Folder"
- BeginProperty Font
- Name = "Verdana"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 495
- Left = 5940
- TabIndex = 2
- Top = 975
- Width = 2205
- End
- Begin VB.DirListBox Dir2
- BeginProperty Font
- Name = "Verdana"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 765
- Left = 6000
- TabIndex = 1
- Top = 120
- Visible = 0 'False
- Width = 2055
- End
- Begin VB.FileListBox File1
- BeginProperty Font
- Name = "Verdana"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 480
- Left = 75
- TabIndex = 0
- Top = 885
- Visible = 0 'False
- Width = 2430
- End
- Begin RichTextLib.RichTextBox RichTextBox1
- Height = 3450
- Left = 45
- TabIndex = 5
- Top = 2085
- Width = 8130
- _ExtentX = 14340
- _ExtentY = 6085
- _Version = 393217
- Enabled = -1 'True
- ScrollBars = 3
- RightMargin = 8e6
- TextRTF = $"DirMap.frx":0000
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "Verdana"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- End
- Begin VB.Label Label1
- BeginProperty Font
- Name = "Verdana"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 315
- Left = 60
- TabIndex = 6
- Top = 1680
- Width = 6480
- End
- Attribute VB_Name = "DirMapForm"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- ' ******************************
- ' ******************************
- ' ** MASTERING VB6 **
- ' ** by Evangelos Petroutos **
- ' ** SYBEX, 1998 **
- ' ******************************
- ' ******************************
- Option Explicit
- Dim InitialFolder As String
- Dim totalFolders As Long, totalFiles As Long
- Dim currentDepth As Integer
- Dim DirStructure As String
- Dim T1 As Long
- Const newLine = "{\par }"
- Function DoubleSlashes(txt As String) As String
- Dim k As Integer
- Dim newtxt As String
- For k = 1 To Len(txt)
- If Mid$(txt, k, 1) = "\" Then
- newtxt = newtxt & "\\"
- Else
- newtxt = newtxt & Mid$(txt, k, 1)
- End If
- Next
- DoubleSlashes = newtxt
- End Function
- Private Sub Command1_Click()
- 'T1 = Timer
- totalFiles = 0
- totalFolders = 0
- currentDepth = 1
- InitialFolder = CurDir
- DirStructure = "{"
- DirStructure = DirStructure & "{\b " & DoubleSlashes(Dir2.List(-1)) & "}" + newLine
- Screen.MousePointer = vbHourglass
- ScanFolders
- DirStructure = DirStructure & "}"
- RichTextBox1.TextRTF = DirStructure
- Label1.Caption = "Scanned " & totalFolders & " folders containing " & totalFiles & " files"
- Screen.MousePointer = vbDefault
- 'MsgBox Timer - T1
- End Sub
- Sub ScanFolders()
- Dim subFolders As Integer
- Dim txtLine As String
- Dim i As Integer, j As Integer
- txtLine = ""
- For j = 0 To File1.ListCount - 1
- txtLine = txtLine & Space(currentDepth * 5) + File1.List(j) & newLine
- Next
- totalFiles = totalFiles + File1.ListCount
- DirStructure = DirStructure & txtLine
- subFolders = Dir2.ListCount
- If subFolders > 0 Then
- currentDepth = currentDepth + 1
- For i = 0 To subFolders - 1
- 'msgbox "moving from " & CurDir & " to " & Dir2.List(i)
- DirStructure = DirStructure & "{\b " & DoubleSlashes(Dir2.List(i)) & "}" & newLine
- File1.Path = Dir2.List(i)
- ChDir CurDir
- Dir2.Path = Dir2.List(i)
- ScanFolders
- Next
- totalFolders = totalFolders + subFolders
- Label1.Caption = "Processed " & totalFolders & " folders"
- currentDepth = currentDepth - 1
- DoEvents
- End If
- MoveUp
- File1.Path = Dir2.Path
- End Sub
- Sub MoveUp()
- If Dir2.List(-1) <> InitialFolder Then
- ChDir Dir2.List(-2)
- Dir2.Path = Dir2.List(-2)
- End If
- End Sub
- Private Sub Dir1_Change()
- ChDir Dir1.Path
- Dir2.Path = Dir1.Path
- File1.Path = Dir2.Path
- End Sub
- Private Sub Drive1_Change()
- ChDrive Drive1.Drive
- Dir1.Path = Drive1.Drive
- Dir2.Path = Drive1.Drive
- End Sub
- Private Sub Form_Load()
- ChDrive App.Path
- ChDir App.Path
- End Sub
- Private Sub Form_Resize()
- If DirMapForm.Width < 8520 Then
- DirMapForm.Width = 9000
- End If
- If DirMapForm.Height < (RichTextBox1.Top + 3450) Then
- DirMapForm.Height = RichTextBox1.Top + 3450
- End If
- RichTextBox1.Width = DirMapForm.Width - 5 * RichTextBox1.Left
- RichTextBox1.Height = DirMapForm.Height - RichTextBox1.Top - 525
- End Sub
-