I'm trying to find the most efficient way to return a list of file names in a folder that start with a particular string of text but ignore any that have the letter "R" directly after this particular string.
This is an example of a situation:
Folder contains these files (among many other files):
18-001.jpg
18-001 A.jpg
18-001 B.jpg
18-001R1.jpg
18-001R2.jpg
18-001R2 V2.jpg
18-001R2 V3.jpg
I'd like to find any files that start with "18-001" except the revisions of "18-001" (the revisions have an "R" straight after the "18-001").
So in this scenario I'd be wanting to return only these file names:
18-001.jpg
18-001 A.jpg
18-001 B.jpg
My client uses the following file naming convention:
Base design number: "YY-###.jpg" (eg. "18-001.jpg" would be the first design created in the year 2018)
Revision of a design: "YY-###R#.jpg" (eg. "18-001R2.jpg" would be the second revision of design number 18-001. For all intents and purposes these revisions are treated as separate designs to their base design. The "R" is always placed directly after the base design number without any spaces.)
Occasionally the client adds additional trailing identifiers to a design number. These vary and can be anything, (eg. "18-001 A.jpg", "18-001-A.jpg", 18-001 V2.jpg", "18-001 Rear View.jpg", etc).
These are also sometimes added to design revisions too, (eg. "18-001R2 A.jpg", "18-001R2-A.jpg", 18-001R2 V2.jpg", "18-001R2 Rear View.jpg", etc). These may or may not have a space after the base design number but will never start with a capital "R" without a space first.
Assuming I have correctly established the start of the file path string [FilePath].
Lets say the value of my field [DesignNumber] is for example "18-001"
At the moment I am establishing if there are any files which are based on design "18-001" (except for revisions) by doing something like this:
This works but it only captures either the base design number or files that have the design number with a space before the identifier. They may use dashes or underscores (or anything really) after the base design number and I want to make sure I capture any and all variations - I just want to avoid the revisions (trailing "R") as these are treated as a different design number.Code:If Len(Dir([FilePath] & [DesignNumber] & ".*"))>0 Or Len(Dir([FilePath] & [DesignNumber] & " *"))>0 Then
I have tried the following but it doesn't seem to work:
Could someone show me an efficient way to achieve this (refer to my opening sentence)?Code:If Len(Dir([FilePath] & [DesignNumber] & "[!R]*"))>0 Then
Sorry about the long winded explanation - thought some context might help.