Interact with the local file system: Difference between revisions
Jump to navigation
Jump to search
Jkuehlthau (talk | contribs) No edit summary |
Jkuehlthau (talk | contribs) |
||
Line 2: | Line 2: | ||
<source lang="vb"> | <source lang="vb"> | ||
Sub VBScriptProcedure | Sub VBScriptProcedure | ||
' For some reason, the FileExists function never works for me. See alternative below. | |||
' If Not FileExists(AttachmentPath & "@@ORG:FILENAME@@") Then | |||
' GotoNextRow | |||
' End If | |||
dim f_string | |||
f_string = ReadFile(AttachmentPath & "@@ORG:FILENAME@@") | |||
If f_string = "" Then | |||
LogMessage "File Does Not Exist: @@ORG:FILENAME@@" | |||
GotoNextRow | GotoNextRow | ||
End If | End If |
Revision as of 18:48, 8 September 2015
Check if a file exists
Sub VBScriptProcedure ' For some reason, the FileExists function never works for me. See alternative below. ' If Not FileExists(AttachmentPath & "@@ORG:FILENAME@@") Then ' GotoNextRow ' End If dim f_string f_string = ReadFile(AttachmentPath & "@@ORG:FILENAME@@") If f_string = "" Then LogMessage "File Does Not Exist: @@ORG:FILENAME@@" GotoNextRow End If End Sub
Move and rename a file
I imported files directly into a Sugar instance's database. The file had to be named the Knowledge Base Article's ID. I moved and renamed the file as the KB article was create:
Sub VBScriptProcedure MoveFile "@@ORG:FullName@@","C:\uploads\@@STG:1,id@@" End Sub