test existance with variable name

  • Hello everyone

    I use this little script to test if my file exists
    public void Main()
    { string filelocation = @"c:\source\production.txt";
    if (File.Exists(filelocation) == true)
    { Dts.Variables["FileExits"].Value = true; }
    else { Dts.Variables["FileExits"].Value = false; }
    Dts.TaskResult = (int)ScriptResults.Success; }

    now I want to change it to test the file with a name that varies
    thank you for your help

  • joujousagem2006 1602 - Tuesday, August 7, 2018 8:08 AM

    Hello everyone

    I use this little script to test if my file exists
    public void Main()
    { string filelocation = @"c:\source\production.txt";
    if (File.Exists(filelocation) == true)
    { Dts.Variables["FileExits"].Value = true; }
    else { Dts.Variables["FileExits"].Value = false; }
    Dts.TaskResult = (int)ScriptResults.Success; }

    now I want to change it to test the file with a name that varies
    thank you for your help

    Change the hard coded value to use a package variable, and properly populate that value outisde of the script task, and prior to it's execution.

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

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

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