I am trying to download multiple files that are located in multiple folders from an FTP site into multiple folders on a specific drive using FTP task and script task in SSIS. I am not downloading the files into one specific folder. I have looked everywhere and I could not find any good information. Any help is much appreciated. Thanks.
If you're not required to use a script task for some reason, then here is what you want to do:
Collection
tab, Folder
field, browse to the folder that contains all of the subfolders that you are pulling files from off your source FTP. (This is making the assumption that such a folder exists, which hopefully it does or you can create one) Traverse Subfolders
box, and choose Fully Qualified
Variable Mappings
tab, create a variable @FileNameWithPath
or whatever you want to call it. Index default is fine. FileName
FileName
to this, which will remove the path: RIGHT(@[User::FileNameWithPath], FINDSTRING(REVERSE(@[User::FileNameWithPath]), "\\\\", 1 )-1)
FilePrefix
FileName
. It will be this, if you're grabbing everything before the first underscore: LEFT( @[User::FileName],FINDSTRING(((DT_WSTR, 150) @[User::FileName] ), "_", 1)-1)
DestinationFolder
. FilePrefix
variable you just created to build the expression for DestinationFolder
. It will be this: "\\\\Your destination FTP\\" + @[User::FilePrefix]
File System Task
File System Task
to a move or copy, whatever you need, with a Source Variable
of FileNameWithPath
, and a destination variable of DestinationFolder
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.