Nevermind - I found something that will work
-------------
Private Sub Command1_Click()
Dim MyFileNm(2) As String
Dim FSO
With Application.FileSearch
.LookIn = "C:\Documents and Settings\Owner\Desktop\Misc"
.SearchSubFolders = True
.FileName = "*.txt"
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
MyFileNm(1) = .FoundFiles(i)
MyFileNm(2) = RReplace(.FoundFiles(i), ".", "_")
MyFileNm(2) = RReplace(MyFileNm(2), "_txt", ".txt")
Set FSO = CreateObject("Scripting.FileSystemObject")
If FSO.FileExists(MyFileNm(1)) Then
FSO.copyfile MyFileNm(1), MyFileNm(2), True
End If
Next i
Else
MsgBox "There were no files found."
End If
End With
End Sub
------------------
Public Function RReplace(strText As String, strFind As String, strReplace As String) As String
RReplace = Replace(strText, strFind, strReplace)
End Function
Take Care
|