I have to process these documents to delete the first dwg files if the is another updates of the files in folder like -01, -02.
For example for 100-00011815730001- i have to keep only 100-00011815730001-02 and delete the -01 and -. Same for 100-00011815730002- .
I have the ID: “100-00011815730001” I want to keep in folder only the “100-00011815730001-02” version of it because is the newer.
The same for ID: “100-00011815730002” I want to keep in folder only the “100-00011815730001-01” version of it because is the newer.
Was working on a regex / FileInfo / SetOperation Approach with a sample set
Vars:
Flow:
arrAllFileInfos = New DirectoryInfo("C:\_demo\FileSystem\GetLastDemo").GetFiles("*.txt")
arrKeepSet =
(From fi In arrAllFileInfos
Let cr = Regex.Match(fi.Name,".*(?=\-)").Value
Group fi By k=cr Into grp=Group
Let grpo = grp.OrderBy( Function (x) CInt("0" & Regex.Match(x.Name, "(?<=\-)\d*?$").Value))
Select f=grpo.Last()).toArray