Experts Exchange connects you with the people and services you need so you can get back to work.
Improve company productivity with a Business Account.Sign Up
ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.
One of a set of tools we're offering as a way to say thank you for being a part of the community.
Dim fso, fld, sf, fil, tsIn, tsOut, Lines, LineLen, TimeStamp, TheLine, Counter
Const SourceFolder = "c:\Source" 'change as needed
Const MaxWidth = 80
TimeStamp = Year(Now) & Right("0" & Month(Now), 2) & Right("0" & Day(Now), 2) & _
Right("0" & Hour(Now), 2) & Right("0" & Minute(Now), 2) & Right("0" & Second(Now), 2)
Set fso = CreateObject("Scripting.FileSystemObject")
Set fld = fso.GetFolder(SourceFolder)
Set sf = fso.CreateFolder(SourceFolder & "\Results " & TimeStamp)
For Each fil In fld.Files
If LCase(fil.Name, 4) = ".txt" Then
Set tsIn = fso.OpenTextFile(fil.Path)
Set tsOut = fso.CreateTextFile(sf.Path & "\" & fil.Name)
Lines = 0
Do Until tsIn.AtEndOfStream
Lines = Lines + 1
TheLine = tsIn.ReadLine
LineLen = Len(TheLine)
If Lines < 6 Then
For Counter = 1 To LineLen Step MaxWidth
tsOut.WriteLine Mid(TheLine, Counter, MaxWidth)
Set tsIn = Nothing
Set tsOut = Nothing
Set sf = Nothing
Set fil = Nothing
Set fld = Nothing
Set fso = Nothing
Open in new window
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.