Problem importing FTP file with varying name
Hello. It's pretty easy to use an SSIS FTP task to pull down a file whose name is known. It's proving to be more difficult to do so when the filename can vary. Mine depends on the date and is easy enough to calculate. The problem is getting the FTP task to store it in a local folder. I keep getting: Error: 0xC0029186 at FTPScheduleFile, FTP Task: Directory is not specified in the file connection manager "ScheduleFile". Where ScheduleFile is a FlatFile Connection Manager. Everything looks like it's setup properly and I've tried several variations to no avail. In the past I think I've coded all the FTP activity in a script and not relied on an FTP task at all. Below is my script that runs ahead of the FTP task. Has someone else run into this particular issue? Thanks, Ken public void Main() { //On 6/14/2011 the name of the file to pull is "Agent_Schedule_Daily_1100614_0305" string sRunDate = (DateTime.Now.Year - 2000) + DateTime.Now.Month.ToString("00") + DateTime.Now.Day.ToString("00"); //This variable is used by the FTP task for the remote file to pull, works well Dts.Variables["SmartSyncAgentFile"].Value = "/Agent_Schedule_Daily_" + sRunDate + "_0305"; //This is the destination machine\folder\file for the Flatfile connection manager using "Folder exists" option string sHomeDir = "\\\\nyobgeccrimp1\\IEXData\\"; Dts.Connections["ScheduleFile"].ConnectionString = sHomeDir + Dts.Variables["SmartSyncAgentFile"].Value.ToString().Substring(1); //Tried it with a DTS variable but with same error //Dts.Variables["LocalAgentFile"].Value = sHomeDir + Dts.Variables["SmartSyncAgentFile"].Value.ToString().Substring(1); //This displays intended value MessageBox.Show(Dts.Connections["ScheduleFile"].ConnectionString); Dts.TaskResult = (int)ScriptResults.Success; }
June 14th, 2011 4:33pm

Perhaps set it to download any file and then capture its name. See if my post helps: http://geekswithblogs.net/Compudicted/archive/2011/05/17/how-to-ftp-and-process-anyhow-named-file.aspxArthur My Blog
Free Windows Admin Tool Kit Click here and download it now
June 14th, 2011 4:35pm

You mentioned that ScheduleFile is a FlatFile Connection Manager - do you mean FileConnectionManager? If yes, are you making sure you set a LocalPath and RemotePath in the FTPTask (whether by Variable or manually) - I believe the fields are required. I'm assuming the FileConnection manager is pointed at a folder and not an individual file - did you make sure this folder exists already?
June 14th, 2011 11:43pm

Thanks for the replies. Yes, I over coded this one. Letting the file come down with it's given name from the source is working. In fact, I don't even have to capture the filename; it's saved as the source name. Ken
Free Windows Admin Tool Kit Click here and download it now
June 15th, 2011 10:13am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics