sql server - Exclude specific Sub Folders -
i got package runs through folder , it's sub folders client data. agreement has changed , client post data in different folder name every time. wondering if can foreach loop on main folder , exclude specific folders archive
.
i don't have knowledge in writing scripts wondering if ssis can without script.
using execute script task
get list of - filtered - files using execute script task
before entering loop , loop on using foreach loop container (ado enumerator)
- you have a ssis variable (ex:
user::fileslist
) typesystem.object
(scope: package) - add
execute script task
before each loop container , adduser::fileslist
readwrite variable in script write following code:
imports system.linq imports system.io imports system.collections.generic public sub main() dim directory string = "c\temp" dim strsubdirectory string = directory & "\new folder" dim lstfiles new list(of string) lstfiles.addrange(directory.getfiles(directory, "*.*", searchoption.topdirectoryonly).where(function(x) not x.contains(strsubdirectory)).tolist) dts.variables.item("fileslist").value = lstfiles dts.taskresult = scriptresults.success end sub
in each loop container choose enumertaion type
from variable enumerator
, choosefileslist
variable source
screenshots
using expression task
for more details can refer answer in following link (it similar case) wildcards in ssis collection {not include} name xlsx
Comments
Post a Comment