Function TestFolderExists(folderpath As String) As Integer
	' tests if folder exists, returns 1 for true, 0 for false
	
	On Error Goto FErrorHandler
	
	If (Getfileattr(folderpath)=16) Then
		' no file exists
		TestFolderExists = 0
	Else
		' file existed
		TestFolderExists = 1
	End If
	Exit Function
	
FErrorHandler:
	' occurs usually for acl issues
	TestFolderExists=0
	Exit Function
End Function