David Sladdin
posted this
31 January 2020
- Last edited 31 January 2020
Hi Luca!
Many thanks for the fantastic speedy reply. I've put in the script block and pointed the script to the vbs file on my D drive. I think I'm missing how to get the folder path (FOLDER_PATH) out of the script as when I look in the log it states:
File destination path: '%FOLDER_PATH%\R2018.pdf'
So the file name is correct but the path is not. For the Windows File System output folder I have put %FOLDER_PATH%
Here is the script:
Option Explicit
on error resume next
Dim objFolder, objFSO, objSubFolder, iFolders
Dim variable
Set objFSO = CreateObject("Scripting.FileSystemObject")
iFolders = 0
'variable = "ABC"
variable = Metadata.Values("TRAVIS_HAW_REF")
Call CheckFolders("D:\Output")
Sub CheckFolders(strPath)
Set objFolder = objFSO.GetFolder(strPath)
For Each objSubFolder In objFolder.SubFolders
If (StrComp(objSubFolder.Name,variable) = 0) Then
call Application.Log(99, "Folder Found: " & objSubFolder.Path)
call Metadata.SetValues("FOLDER_PATH", objSubFolder.Path)
msgbox("Folder Found: " & objSubFolder.Path)
End If
Call CheckFolders(objSubFolder.Path)
Next
If Err.Number <> 0 Then
msgbox "Error in CheckFolders:" & Err.Description
call Application.Log(99, "Error in CheckFolders:" & Err.Description)
Err.Clear
End If
End Sub
Can you see what I've done incorrectly?
Thanks again,
Dave.