0 votes
by (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
by (160 points)
able to create long directories but file operations like upload and rename are failed.

1 Answer

+1 vote
by (73.5k points)
selected by
 
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.
by (160 points)
edited by
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.
...