Discuss (FTP), (FTP on .NET CF) and (FTPS, SFTP and SCP).
no avatar
User

ErTanu

Posts

20

Joined

Wed Jun 04, 2014 3:27 pm

Can we create the zip folder of existing folder on FTP Serve

by ErTanu » Wed Jun 04, 2014 10:53 pm

no avatar
User

EDT Support

Posts

905

Joined

Mon Apr 26, 2004 3:03 pm

by EDT Support » Thu Jun 05, 2014 9:54 am

no avatar
User

EDT Support

Posts

905

Joined

Mon Apr 26, 2004 3:03 pm

by EDT Support » Thu Jun 05, 2014 10:18 am

no avatar
User

ErTanu

Posts

20

Joined

Wed Jun 04, 2014 3:27 pm

by ErTanu » Thu Jun 05, 2014 5:08 pm

Ok. I have an EXE doing the zip task. I have already purchased the PRO version.

I want to run exe present on my ftp server from my ASP.NET webAPI. Or rather to say want to invoke exe present on FTP server from my code.
Can i use InvokeCommandSSH? if yes how to use it? or Is there any other option to run that EXE.
Thanks!
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

by support2 » Thu Jun 05, 2014 9:03 pm

Are you connecting to your server via SFTP? You need to check that your SFTP server permits exec'ing of binaries, and determine what path to use.
no avatar
User

ErTanu

Posts

20

Joined

Wed Jun 04, 2014 3:27 pm

by ErTanu » Thu Jun 05, 2014 9:15 pm

Yes I am connecting to the server via SFTP.
My code looks like:
SecureFTPConnection sftp = new SecureFTPConnection();

sftp.ServerAddress = ftpBaseIP;
sftp.UserName = ftpUsername;
sftp.Password = ftpPassword;
// set the protocol to SCP
sftp.Protocol = FileTransferProtocol.SCP;


if (sftp.IsConnected)
sftp.Close();
sftp.Timeout = 0;
sftp.Connect();



string[] args = { "tanutest" };

sftp.InvokeCommandSSH(new Uri("D:/Temp/ConsoleApplicationForFTP.exe").AbsolutePath, args);

Am i missing something here.
Is there any mismatch in syntax.

Also how to check that the SFTP server permits exec'ing of binaries, and as mentioned above i need to use D:/Temp of FTP Server.

Thanks,
Tanu
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

by support2 » Thu Jun 05, 2014 9:38 pm

Here's an example

string[] parameters = new string[2];
parameters[0] = "<time_stamp>";
parameters[1] = "<file_Path>";
string reply = ftpConnection.InvokeCommandSSH("chmtime ", parameters);

It is unlikely that the server will let you arbitrarily execute commands like zip on arbitrary directories - that would be a significant security hole. You may need to talk to the server administrator to find out if what you want to do is possible.
no avatar
User

ErTanu

Posts

20

Joined

Wed Jun 04, 2014 3:27 pm

by ErTanu » Thu Jun 05, 2014 10:23 pm

Failed to connect to XXX.XX.XX.XX:XX within timeout -1 ms

at sftp.Connect();

Don't know why?
This is when i am using :
// set the protocol to SCP
sftp.Protocol = FileTransferProtocol.SCP;
Last edited by ErTanu on Thu Jun 05, 2014 10:47 pm, edited 1 time in total.
no avatar
User

ErTanu

Posts

20

Joined

Wed Jun 04, 2014 3:27 pm

by ErTanu » Thu Jun 05, 2014 10:27 pm

When not setting the above protocol mentioned i am getting : "SFTP/SCP protocol required for InvokeCommandSSH" at:
string reply = sftp.InvokeCommandSSH("chmtime ", parameters);

:(
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

by support2 » Fri Jun 06, 2014 7:07 am

You need to use SFTP.

But your server may not support exec'ing remote commands - you need to check with the server administrator to see if 1) it can and 2) the location of the zip exe

Also 'chmtime ' was just an example of how to invoke a remote command - the actual command you will be using is 'zip ' or 'gzip ' or something like that (depending on what is supported on the server).

Who is online

Users browsing this forum: No registered users and 20 guests

Powered by phpBB ® | phpBB3 Style by KomiDesign
cron