Ken_Smith1952
asked on
How to manipulate file names?
I am trying to write a Vb application to read in files named with a format of nnnnnn.nnnnnn_xx and strip out the (.) and add a(.dxf) extension. I would want to
make this conversion to all like files in a single directory.
make this conversion to all like files in a single directory.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
sirbounty is a much faster typist! :)
Hi Ken_Smith1952,
I don't think sirbounty's code is picking up the last part of the file name after the "."
Either looping method should work, but how about simplifying the string replacement like this:
strNewFileName = Replace(strNewFileName,"." ,"") & ".dxf
I don't think sirbounty's code is picking up the last part of the file name after the "."
Either looping method should work, but how about simplifying the string replacement like this:
strNewFileName = Replace(strNewFileName,"."
Er, Ken_Smith1952 - which comment(s) did you intend to accept here?
Const myDir As String = "c:\myFolder\"
Dim myFile As String
myFile = Dir(myDir & "*.*")
Do Until myFile = ""
Name myDir & myFile As myDir & Left(myFile, InStr(myFile, ".")) & "dxf"
myFile = Dir()
Loop
End Sub