c# - SSIS Script Task check if file exists -
i'm trying use script task check if file in folder. if file there package continue through steps, if not should quit. have variable user::uvifexistsfilename used c# script check , see if file exists in location. right now, have use full file name, i.e. data.csv , precedence constraint return true if file name matches. change value of ifexistsfilename variable string data.csv *.csv. when chance first part of variable wild card returns unmatched. i'm sure supposed to, don't know how return true when .csv file present. each loop comes after in process uses wildcards fine script not having of it.
thanks in advance.
you need add variable holds path w/o file name , use directory.getfiles
this:
string[] files = system.io.directory.getfiles(dts.variables["user::folderpath"].value.tostring(), "*.csv", system.io.searchoption.topdirectoryonly); if (files.length > 0) dts.variables["user::csvfileexists"].value = true
Comments
Post a Comment