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 (optimized)"
- ClientHeight = 6150
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 8415
- LinkTopic = "Form1"
- ScaleHeight = 6150
- ScaleWidth = 8415
- StartUpPosition = 3 'Windows Default
- 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 = 675
- Left = 135
- TabIndex = 5
- Top = 1125
- Visible = 0 'False
- Width = 2430
- 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 = 990
- Left = 6000
- TabIndex = 3
- Top = 150
- Visible = 0 'False
- Width = 2055
- End
- Begin VB.CommandButton Command1
- Caption = "Map this Folder"
- BeginProperty Font
- Name = "Verdana"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 495
- Left = 6000
- TabIndex = 2
- Top = 1305
- Width = 2205
- 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 = 1440
- Left = 2805
- TabIndex = 1
- Top = 360
- Width = 2925
- End
- 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 = 135
- TabIndex = 0
- Top = 345
- Width = 2430
- End
- Begin RichTextLib.RichTextBox RichTextBox1
- Height = 3450
- Left = 135
- TabIndex = 4
- Top = 2550
- Width = 8130
- _ExtentX = 14340
- _ExtentY = 6085
- _Version = 393217
- 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 = 180
- TabIndex = 6
- Top = 2145
- Width = 5340
- End
- Attribute VB_Name = "DirMapForm"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Dim InitialFolder As String
- Dim currentDepth As Integer
- Dim DirStructure As String
- Dim tmpDirStructure As String
- Dim totalFolders As Integer, totalFiles As Integer
- 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
- tmpDirStructure = ""
- DirStructure = "{"
- DirStructure = DirStructure & "{\b " & DoubleSlashes(Dir2.List(-1)) & "}" + newLine
- Screen.MousePointer = vbHourglass
- DoEvents
- ScanFolders
- If tmpDirStructure <> "" Then
- DirStructure = DirStructure & tmpDirStructure
- End If
- 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 j As Integer, i As Integer
- txtLine = ""
- totalFiles = totalFiles + File1.ListCount
- For j = 0 To File1.ListCount - 1
- txtLine = txtLine & Space(currentDepth * 5) + File1.List(j) & newLine
- Next
- tmpDirStructure = tmpDirStructure & txtLine
- subFolders = Dir2.ListCount
- totalFolders = totalFolders + subFolders
- Label1.Caption = "Processed " & totalFolders & " folders"
- DoEvents
- If subFolders > 0 Then
- currentDepth = currentDepth + 1
- For i = 0 To subFolders - 1
- 'msgbox "moving from " & CurDir & " to " & Dir2.List(i)
- tmpDirStructure = tmpDirStructure & "{\b " & DoubleSlashes(Dir2.List(i)) & "}" & newLine
- If Len(tmpDirStructure) > 8000 Then
- DirStructure = DirStructure & tmpDirStructure
- tmpDirStructure = ""
- End If
- File1.Path = Dir2.List(i)
- ChDir CurDir 'Dir2.List(i)
- Dir2.Path = Dir2.List(i)
- ScanFolders
- Next
- 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 Left(CurDir, 3)
- 'Drive1.Drive = Left(CurDir, 3)
- ChDir CurDir
- 'File1.Path = App.Path
- End Sub
- Private Sub Form_Resize()
- RichTextBox1.Height = DirMapForm.Height - RichTextBox1.Top - 525
- End Sub
-