SSIS Execute Process Task forfiles not working

  • I'm trying to use forfiles in an Execute Process Task in my SSIS package to delete files older than 10 days.

    When I run the cmd directly from commandline it works. But, when I run the same command from the Execute Process Task in my SSIS package nothing happens and no error is thrown. I just get "package execution completed with success"

    Here are the configurations I've tried:

    OPTION 1:

    Executable - C:\WINDOWS\system32\forfiles.exe

    Arguments - /P "C:\MY_PATH_HERE" /M *.bak /D -10 /C "cmd /c del @path"

    OPTION 2:

    Executable - C:\WINDOWS\system32\forfiles.exe

    Arguments - forfiles /P "C:\MY_PATH_HERE" /M *.bak /D -10 /C "cmd /c del @path"

    OPTION 3:

    Executable - C:\WINDOWS\system32\cmd.exe

    Arguments - forfiles /P "C:\MY_PATH_HERE" /M *.bak /D -10 /C "cmd /c del @path"

    OPTION 4:

    Executable - C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

    Arguments - dir "C:\MY_PATH_HERE\*.bak" |? {$_.LastWriteTime -lt (get-date).AddDays(-10)} | del

    How do I need to alter my Execute Process Task to get this to work?

    • This topic was modified 2 months, 4 weeks ago by s15199d.
    1. Are the file paths local to the server on which the command is executing, or on a network?
    2. Does the account running the SSIS package have the necessary rights to delete the files?

     


  • Nevermind.  Ended up being a file security issue.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply