locked
Retrieve files from folder + SSIS Script task RRS feed

  • Question

  • User-73514677 posted

    Hi.

    I am trying to retrieve files from a folder using the script task functionality in SSIS.

    I have created a variable called ExcelFolder which contains the path of the files. In the script task, I have used the code as below

      // ExcelFolder contains value as D:\test\folder1\
    
     excelFolder = Dts.Variables["ExcelFolder"].Value.ToString();             
     var directory = new DirectoryInfo(excelFolder);
     FileInfo[] files = directory.GetFiles(excelFolder);

    I am getting error in the files line as - Second path fragment must not be a drive or UNC name.\r\nParameter name: path2

    How to fix this?

    Thanks

    Friday, March 27, 2020 12:47 PM

All replies

  • User475983607 posted

    I am getting error in the files line as - Second path fragment must not be a drive or UNC name.\r\nParameter name: path2

    How to fix this?

    The error is very very clear.  There is something wrong with the path which is coming from configuration.  Only you know what the path is and only you can verify if the path is correct.   I recommend using the Visual Studio debugger to check your logic.

    Friday, March 27, 2020 2:33 PM