Check Foldername with RegEX

  • 234 Views
  • Last Post 17 February 2023
mischulu posted this 16 February 2023

Hello,

I need help with a specific requirement. I have a string like _ABC_2023_001_TENT_BOSTON, which I took from the Smart OCR via RegEx. In the next step, I would like to use a VBS script and RegEx to check whether a folder with the unique name _ABC_2023_001_ exists.

If so, the file should be placed in the folder like _ABC_2023_001_XXXX XXXX. The customer is unsure whether the end of the character string is always unique.

If not, the file will be directed to a different path. So far I've gotten this far:

 

dim objFSO, objFolder, objSubFolder, objRegExp

Set objFSO = CreateObject("Scripting.FileSystemObject")

Call CheckFolders("D:\OUTPUT\PROJECTS\")

Set objRegExp = New RegExp
objRegExp.Pattern = "_ABC_\d{4}_\d{3}_"

Sub CheckFolders(strPath)

Set objFolder = objFSO.GetFolder(strPath)

    For Each objSubFolder In objFolder.SubFolders
        If objRegExp.Test(objSubFolder.Name) Then
        .................
        else
        ................
End Sub

 

Can anyone help me on this?

Thanks in advance,

Greetings Michael

Attached Files

Order By: Standard | Newest | Votes
luca.scarpati posted this 17 February 2023

 Hi Michael,

 

I read your purpose and it's feasible maybe you can do everything in a script (maybe via Connecrtor script too) even sending a variable of the full path to the final WFS, for example some way like this:

We suggest for the script maybe check out this suggested post on our forum:

 

Otherwise since yours is a specific customer process maybe you can contact your first level support and for sure they will be able to give you more information or offer you Professional Services from us.

 

Best regards,

Luca

mischulu posted this 17 February 2023

Hello Luca,

Thank you for your reply smile. I will try the link above. Maybe that will help me.

Thank you very much,

best regards,

Michael

  • Liked by
  • luca.scarpati
Close