Interact with the local file system

From Starfish ETL
Jump to navigation Jump to search

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