Perform command on entering folder?

Try this, works for me. o)

option explicit
'Called by Directory Opus to initialize the script
Function OnInit(initData)
   initData.name = "KTRDeleter"
   initData.desc = "Löscht *.ktr Dateien"
   initData.copyright = "PW"
   initData.version = "1.0"
   initData.default_enable = true
End Function

'Called after a new folder is read in a tab
Function OnAfterFolderChange(afterFolderChangeData)
    'The result property of the AfterFolderChangeData object tells us if the read was successful    
    If not afterFolderChangeData.result Then
		OnAfterFolderChange = true 'true means non-successful
		Exit function
	End if 

	'Check if the path that was read begins with D:\incoming\data        
	If Left(afterFolderChangeData.tab.path, 16) = "D:\incoming\data" Then
		'The path matched, so delete .ktr files
		dim mycmd : set mycmd = DOpus.Create.Command()
		'SetModifier(): corrected syntax, but it has no effect for internal commands
		'mycmd.SetModifier "runmode","hide"
		mycmd.AddLine("Delete QUIET FILE=""" & afterFolderChangeData.tab.path & "\*.ktr""")
		mycmd.Run()
	End If
	
	OnAfterFolderChange = false 'success
End Function

The SetModifier call was wrong, corrected but disabled, because as Jon said, it has no effect for the Delete command.
And "dim mycmd" was indeed missing. o)

Btw: This script revealed the "Delete QUIET NORECYCLE" issue once again while testing. The QUIET switch is nonfunctional in conjunction with NORECYCLE.