can i use sftp in batch file?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
flaskvacuum
Posts: 43
Joined: 08 Mar 2013 11:23

can i use sftp in batch file?

#1 Post by flaskvacuum » 04 Apr 2013 02:53

hi everyone,

i am using ftp in my batch files.

Wonder if i can change to use sftp cos my unix team mention is not safe.

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: can i use sftp in batch file?

#2 Post by Squashman » 04 Apr 2013 06:13

Do you have a command line sftp client that can be scripted.

flaskvacuum
Posts: 43
Joined: 08 Mar 2013 11:23

Re: can i use sftp in batch file?

#3 Post by flaskvacuum » 05 Apr 2013 01:50

Squashman wrote:Do you have a command line sftp client that can be scripted.


Didn't really get u.

To use ftp on the command line one would just ftp <ip> and it will prompt u further for the user & password.

I tried
Sftp -b batchfile.txt unsucessfully.

The batch file contain the logins details cos need to run it without any interaction.

The batchfile(located in a win machine, via a .bat) needs to acess some unix server and mget a log.
Please further advice.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: can i use sftp in batch file?

#4 Post by foxidrive » 05 Apr 2013 06:01

flaskvacuum wrote:
Squashman wrote:I tried
Sftp -b batchfile.txt unsucessfully.


What error message did you get?

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: can i use sftp in batch file?

#5 Post by Squashman » 05 Apr 2013 06:36

flaskvacuum wrote:
Squashman wrote:Do you have a command line sftp client that can be scripted.


Didn't really get u.

To use ftp on the command line one would just ftp <ip> and it will prompt u further for the user & password.

I tried
Sftp -b batchfile.txt unsucessfully.

The batch file contain the logins details cos need to run it without any interaction.

The batchfile(located in a win machine, via a .bat) needs to acess some unix server and mget a log.
Please further advice.

What don't you understand about client/server technology?
If you want to transfer files using FTP, you need a FTP Server and to connect to that server you need to use a FTP client. Same goes for using SFTP. You need a SFTP server and a SFTP client.

Windows has a native FTP client. Windows does not have a native SFTP client.

flaskvacuum
Posts: 43
Joined: 08 Mar 2013 11:23

Re: can i use sftp in batch file?

#6 Post by flaskvacuum » 06 Apr 2013 01:37

Squashman wrote:
flaskvacuum wrote:
Squashman wrote:Do you have a command line sftp client that can be scripted.


What don't you understand about client/server technology?
If you want to transfer files using FTP, you need a FTP Server and to connect to that server you need to use a FTP client. Same goes for using SFTP. You need a SFTP server and a SFTP client.

Windows has a native FTP client. Windows does not have a native SFTP client.


tks for the kick start. still trying on the downloaded putty psftp client.

Post Reply