Advertisement
Java_Volume1 Data Structures #103821

Email Extraction

The is the first of its kind that i have seen. It extracts emails from the c:\program files directory and subdirectorys please vote for me if this is of use to you.

AI

Riepilogo AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Codice sorgente
original-source
' This programme was created by Damien Hally
' Please if you find this programme useful Vote For Me
'
'This programme searches for emails in the programs folder and subfolders
' for emails and sxtracts them into a file on the c:\ drive called name.txt

Imports System.IO
Imports System
Imports Microsoft.VisualBasic
Imports System.Text.RegularExpressions
Module Module1
  Sub main()
    On Error Resume Next
    Dim fname As String
    Dim tx As String
    Dim dname As String
    Dim hd As New FileStream("c:\name.txt", FileMode.OpenOrCreate, FileAccess.Write)
    Dim dh As New StreamWriter(hd)
    For Each dname In Directory.GetDirectories("c:\program files")
      For Each fname In Directory.GetFiles((dname), "*.txt")
        Dim sr As New FileStream((fname), FileMode.Open, FileAccess.Read)
        Dim str As New StreamReader(sr)
        str.BaseStream.Seek(0, SeekOrigin.Begin)
        tx = str.ReadToEnd()
        Dim re As New Regex("[\w\-]+\@[\w\-]+\.\b[\S\-]+\b", RegexOptions.IgnoreCase)
        Dim m As Match = re.Match(tx)
        Do While m.Success
          dh.WriteLine(m)
          m = m.NextMatch
        Loop
        str.Close()
      Next
    Next
    dh.Close()
  End Sub
End Module
Commenti originali (3)
Recuperato da Wayback Machine