Using IsDirectory in remote filter

178 views
Skip to first unread message

msp...@gmail.com

unread,
Jan 3, 2017, 2:32:11 PM1/3/17
to COZYROC
I am trying to confirm that a directory exists before attempting to download a file, I see in the documentation that IsDirectory is an element of RemoteFilter. I am unclear on the proper syntax here, I have my remote path stored as a variable and the task fails if the directory does not exist.

Thanks,
Mike

RemoteFilter

Specify remote files filter criteria. The criteria is specified using FLEE expression. You can use the following elements: Name, FullName, Size, ModifiedTime, IsDirectory.


Ivan Peev

unread,
Jan 3, 2017, 2:34:22 PM1/3/17
to COZYROC
Hi Mike,

Right-click on the SFTP Task and select Properties. Set NoFilesFail=False. Now when you execute the task, it will not fail when the remote file is missing.

msp...@gmail.com

unread,
Jan 4, 2017, 7:17:41 PM1/4/17
to COZYROC
Hi Ivan, thanks for responding. I confirmed that I have NoFilesFail = False.

The issue is that I am providing a Directory + Filename where sometimes the Directory may not yet exist:

"Rebex.Net.FtpException: Could not change to "/DailyFile/Jan-2017"; 'Jan-2017' not found (550).

This occurs as I provide the path + file name "/DailyFile/Jan-2017/filename.xls"

Any tips here to avoid this failure??


Full text::
Error: 0xC002F304 at File Transfer Task, File Transfer Task: An error occurred with the following error message: "Rebex.Net.FtpException: Could not change to "/DailyFile/Jan-2017"; 'Jan-2017' not found (550).
   at Rebex.Net.Ftp.SY(Int32 I, Boolean C)
   at Rebex.Net.Ftp.CW(String I, JHT C)
   at Rebex.Net.Ftp.CW(String I, Boolean C)
   at Rebex.Net.Ftp.RE(String I, Boolean C)
   at Rebex.Net.Ftp.ChangeDirectory(String remotePath)
   at CozyRoc.SqlServer.SSIS.FtpsClientConnection2._GetList(String directory)
   at CozyRoc.SqlServer.SSIS.FtpsClientConnection2._GetRemoteFiles(ArrayList list, String directoryName, String matchName, Boolean includeDir, Boolean recursive, IGenericExpression`1 filterExpr)
   at CozyRoc.SqlServer.SSIS.FtpsClientConnection2.CozyRoc.SqlServer.SSIS.IFtpClient.GetListing(String searchPath, Boolean isWildcard, Boolean includeDir, Boolean recursive, String filter)
   at CozyRoc.SqlServer.SSIS.FileTransferTask._GetRemoteListing(IFtpClient ftpClient, Object remote, Boolean includeDir)
   at CozyRoc.SqlServer.SSIS.FileTransferTask._ExecuteReceive(IFtpClient ftpClient)
   at CozyRoc.SqlServer.SSIS.FileTransferTask._ExecuteAction(IFtpClient ftpClient)".
Warning: 0x80020918 at File Transfer Task, File Transfer Task: Operation "ReceiveFiles" failed.

Ivan Peev

unread,
Jan 4, 2017, 7:24:46 PM1/4/17
to COZYROC
Mike,

You can use this reusable script to check if remote file or folder exists. Use the script with COZYROC Script Task Plus.
Reply all
Reply to author
Forward
0 new messages