SFTP Upload fails when target SFTP directory path exceeds 250 characters

0 votes
asked Mar 29 by athulac (160 points)

I am trying to upload files to the SFTP server using following code

bool FolderFlag = CreateDirectoryInSFTP(SFTPpath);
            if (FolderFlag)
            {
                if ((System.IO.File.Exists(localFileName)))
                {
                    objsftpRebex.Upload(localFileName, SFTPpath, 0, 0, ActionOnExistingFiles.OverwriteAll);
                }
            }    

Where localFileName will be like

string localFileName = @"D:\Temp1\489892\ModifiedFile\AG-Modified
Department of Housing and Urban Development Notice to Targets.pdf";

And SFTPpath is a big string having more than 250 characters
eg:

SFTPpath=@"/uploads/TargetBridge/Target Setup 3/Target-Outgoing/Modifeid Target
Docs/59976/42afa102-8bee-454c-bc57-6b3b8edb721a/ Target Department of
Housing and Urban Development Notice to Modification/AG-Target of
Housing and Urban Development Notice to Modification/

But this code is not working getting error like No such file; File not found.

When the SFTPpath is smaller in length this code is working absolutely fine. Please tell me what is happening while target SFTP path is too long ? or is there any other ways to handle these kind of long directories,files in SFTP?

Applies to: Rebex SFTP
commented Mar 29 by athulac (160 points)
able to create long directories but file operations like upload and rename are failed.

1 Answer

+1 vote
answered Mar 29 by Lukas Matyska (54,470 points)
selected Mar 29 by athulac
 
Best answer

The error is server side. It seems that the server cannot work with long paths.

Possible solutions:

  1. Use shorter paths.
  2. Ask server vendor, whether there is a possibility to enable support of long paths.
commented Mar 29 by athulac (160 points)
edited Mar 29 by athulac
Thanks @Lukas Matyska for the reply,seems like server issue only. Not able to upload the same file using filezilla also. Let me check after contacting them.
...