You are viewing limited content. For full access, please sign in.

Question

Question

I need to delete a file that is located in a windows directory within a workflow.

asked on December 30, 2015

I need to delete a file that is located in a windows directory within a workflow.  I was thinking about running a vb script but not sure if that is the best way. 

0 1

Replies

replied on December 30, 2015

I believe that would be the best method for deleting a file in a windows directory. The only issue is permissions to delete the file. Please check this and have workflow possibly running under a service account that would have access to that directory. Also, prior to deleting, you should include a condition to check if the directory exist before deleting the file.

0 0
replied on December 30, 2015

I could use some help with the vb code.  could you help

0 0
replied on December 30, 2015

I am needing some help with the vb code to delete this file.

0 0
replied on December 30, 2015

I think you would need to do it in a script activity.  https://msdn.microsoft.com/en-us/library/system.io.file.delete%28v=vs.110%29.aspx

0 0
replied on December 30, 2015

Thanks...I was able to get the file to delete when I manually dim the file name....

Dim FileName="c:\ThisFile.txt"

 

Im not sure how to retrieve the file name from the "For Each File" function... into VB

 

0 0
replied on December 30, 2015

Im not sure how to dim the variable "FileName"

 

Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Data.SqlClient
Imports System.Text
Imports System.IO
Imports Laserfiche


Namespace WorkflowActivity.Scripting.Script
    '''<summary>
    '''Provides one or more methods that can be run when the workflow scripting activity is performed.
    '''</summary>
    Public Class Script1
        Inherits ScriptClass90
        '''<summary>
        '''This method is run when the activity is performed.
        '''</summary>
        Protected Overrides Sub Execute()
            'Write your code here.
            dim FileName as Laserfiche.Workflow.Activities.ForEach.ForEachFileFlags = GetTokenValue("ForEachFile_CurrentFile_Full Name")

            file.delete(FileName)
        End Sub
    End Class
End Namespace
 

0 0
replied on December 30, 2015

See your other thread. Please use the Code tag when posting code to make it more readable.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.