C
c mateland
Steve, thanks ever so much for the ideas on the Kill statement. This
question is related to the same project. I'm working on a solution, but
if you have one, feel free to throw it out there.
With the code below, I'm in the middle of a FileSearch where I verify
the quantity of ppa files the user has in a folder that start with
"a^main". If he has one, great, I move on. If he has none, no problem,
got that handled, too.
But if he has more than one, for example he has "a^main0002.ppa" and
"a^main0014.ppa" and "a^main0022.ppa", I want to delete all but
"a^main0022.ppa". (I don't know how multiple files could get in like
that, but it will cause a problem. I have to whittle it down to the one
highest "main" ppa before I can move on, you see.)
So, I'm trying to code where, when more than one such file is found, it
will examine the right 4 digits of the names. FWIW, when only one
"main" file is found, I use the following code elsewhere that
successfully grabs the name and the version (as integer). Maybe I can
use like code in the iterations to find the latest of multiple "main"
files, but I'm having brain-drain trying (although I'll stay at it).
'Get name of main ppa file
sPpaMainName = Dir(.FoundFiles(1))
'Get version number of main ppa file
iPpaMainVer = Mid(sPpaMainName, _
Len(sPpaMainName) - 7, 4)
Here is the file search I'm in where, if >1 "main" files are found,
I'll have to iterate and keep only the latest.
With Application.FileSearch
.NewSearch
.LookIn = sPpaFolder
.SearchSubFolders = False
.FileName = "a^main*.ppa"
.Execute
iPpaMainQty = .FoundFiles.Count
If iPpaMainQty > 1 Then
'CODE: Keep newest file and kill others ???
End If
question is related to the same project. I'm working on a solution, but
if you have one, feel free to throw it out there.
With the code below, I'm in the middle of a FileSearch where I verify
the quantity of ppa files the user has in a folder that start with
"a^main". If he has one, great, I move on. If he has none, no problem,
got that handled, too.
But if he has more than one, for example he has "a^main0002.ppa" and
"a^main0014.ppa" and "a^main0022.ppa", I want to delete all but
"a^main0022.ppa". (I don't know how multiple files could get in like
that, but it will cause a problem. I have to whittle it down to the one
highest "main" ppa before I can move on, you see.)
So, I'm trying to code where, when more than one such file is found, it
will examine the right 4 digits of the names. FWIW, when only one
"main" file is found, I use the following code elsewhere that
successfully grabs the name and the version (as integer). Maybe I can
use like code in the iterations to find the latest of multiple "main"
files, but I'm having brain-drain trying (although I'll stay at it).
'Get name of main ppa file
sPpaMainName = Dir(.FoundFiles(1))
'Get version number of main ppa file
iPpaMainVer = Mid(sPpaMainName, _
Len(sPpaMainName) - 7, 4)
Here is the file search I'm in where, if >1 "main" files are found,
I'll have to iterate and keep only the latest.
With Application.FileSearch
.NewSearch
.LookIn = sPpaFolder
.SearchSubFolders = False
.FileName = "a^main*.ppa"
.Execute
iPpaMainQty = .FoundFiles.Count
If iPpaMainQty > 1 Then
'CODE: Keep newest file and kill others ???
End If