SFTP from windows E:/ to unix server

Hello All :),

I am making a script in the ksh to Secure FTP a set of files from the E:/ drive in windows a computer to a unix server.

Had it been in the unix directory, I could have used the expect utility to use the non-interactive mode for sftp,

#!/usr/local/bin/expect
#!/bin/ksh

spawn sftp -b user@11.11.11
expect "password:"
send "password"

cd /export/home/direc1
lcd /home/direc2

ascii

get new1
quit

or used public key encryption.

But, the file is in the windows directory. How do I get that file?

Do you have an sshd or sftp server on the Windows machine?

of course it has. It actually is a unix server machine on which the windows is also installed.

Do we need a separate sftp installation on the windows OS?

How were we supposed to know that if you did not tell us. You post suggested it was a windows machine.

What environment is this "Windows OS" running in?

How are the file systems mapped between Windows and UNIX?

We know very little about your environment unless you tell us.

I am not very sure of how the system is mapped. In fact, it is very possible that there is no unix installation in it. It could be a Windows only server.
The login credentials I have, have been configured for ftp connectivity.

So?

I can still help you with some more info..

/export/home/pranav> ftp -inv
ftp> open hostname
Connected to hostname.
ftp> user username P@ssword
331 Password required
230 user logged in
ftp> pwd
257 "/" is current directory
ftp> ls
200 command successful
150 Opening ASCII data connection for directory listing
Listen
acd01jax.itf
ACD01PHL.itf
ACD01PHL.OLD
Listen_configuration.ini
Stream1
Stream10
Stream11
Stream12
Stream13
Stream14
Stream15
Stream16
Stream17
Stream18
Stream19
Stream2
Stream20
Stream21
Stream22
Stream23
Stream24
Stream25
Stream26
Stream27
Stream28
Stream29
Stream3
Stream30
Stream31
Stream32
Stream33
Stream4
Stream5
Stream6
Stream7
Stream8
Stream9
xx.xx
226 transfer complete

This is what i was able to do with the connection.

I don't understand the output of 'ls'. If anybody can throw some light on where is this '/' that i get with 'pwd'.

Any ideas will be appreciated.
thanx

Edit: I confirm here that there is no unix installation on the remote server.

Logon onto the Windows box and either

(a) do a file search for some of the name files given in the listing.

(b) go to the control panel and find the panel that configures the ftp server.

and also you are using "ftp", not "sftp" as you mentioned in your original post.

Well, will try this and get back here soon.
Good Day!

I showed ftp here just for simplicity's sake.

Yes but that does not mean it's any part of the solution. What implementation of sftp server are you using on the Windows box?

:b:Hi all,

I've understood the above problem. The FTP server's setting was set for a different directory than required as the Top Directory.

Is there a way by which I can change the directory despite it being set up as the top directory? Otherwise I'll have to ask the admin of the remote system to change the top directory. Still, I am expecting a possibility:rolleyes:.

And about SFTP, the problem remains the same, only add to that the problem of using SFTP in a script in the '-b' mode and using it non-interactively.

So, now.. I'm waiting for any answers to the possibility of changing the top directory from my end. Else, I'll be waiting for the admin approval.
thanxes...

Is the directory of interest below the top? Can you use "cd" to switch to the directory you want?

Sorry for missing out on this info..

No, it is not below the current top directory.
That is why I asked if there's any way to go beyond the top directory.

Any random ideas?

@porter
Special thanks to you my friend! :slight_smile:

No, and that is by design.

Well, then I'll have to manage the rest. The technical part being over.. I leave this thread here:b:. Thank You. :slight_smile:
This thread surely was a great experience..!:cool: