Link to home
Start Free TrialLog in
Avatar of Sh M
Sh MFlag for United States of America

asked on

WINSCP automate files upload and download by windows scripting to oracle fusion

Hi,

I am not familiar with windows scripting.

- I like to know what is command line in dos prompt for a windows script to do SFTP upload/download from windows to Oracle fusion given domain, user name and password.how can this be automated?


- how to create a bat file for the same script and what is the command line for executing the bat file?

Thanks in advance
Avatar of Gerwin Jansen
Gerwin Jansen
Flag of Netherlands image

What kind of server is Oracle Fusion running on?

WinSCP is a secure copy GUI that also has a command line version, are you working with WinSCP already?
Avatar of Sh M

ASKER

I am working with WINSCP and I can drag and drop file to the remote server without problem.

however I need to write a windows script so that it can be automated later.

I put this script together and run it from the dos prompt. I get no error but I don't see the file being uploaded to the server looking at the winscp GUI interface.

here is what I have done so far:

the test.txt is contains only the following numbers: 123.

this is the upload.bat file:

START:
"C:\Program Files(x86)\Winscp\winscp.exe" /command "option batch on" "option confirm off" "open userID@example.com" "put C:\Users\User_name\Desktop\text.txt /" "close" "exit"

any idea what happens to the file?
SOLUTION
Avatar of Bud Durland
Bud Durland
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Sh M

ASKER

Gerwin,
Thanks for your response.

A.
Regarding your first instruction I changed it to from exe to com.
 "C:\Program Files(x86)\Winscp\winscp.com" /command "option batch ......

So it started to search for the host. Asked for password. I entered the password as well:

open userID:password@example.com"

It started authenticating with pre entered password but it shows:
Access is denied. Authentication failed. No session.

B. I like to try your second suggestion but if you don't mind I focus on getting the first step working.
Avatar of Sh M

ASKER

Correction to previous message:

BudDurland,
Thanks for your response.

A.
Regarding your first instruction I changed it to from exe to com.
 "C:\Program Files(x86)\Winscp\winscp.com" /command "option batch ......

So it started to search for the host. Asked for password. I entered the password as well:

open userID:password@example.com"

It started authenticating with pre entered password but it shows:
Access is denied. Authentication failed. No session.

Gerwin,
B. I like to try your second suggestion but if you don't mind I focus on getting the first step working.
>> B. I like to try your second suggestion but if you don't mind I focus on getting the first step working.
No problem at all, I've got this working for quite some time with the /script option. Just let me know if you need further assistance.
Avatar of Sh M

ASKER

Hi Gerwin,

Could you let me know if I am in the right track:
Created a file named: testsctipt.bat
Contains:
"C:\program files (68x)\ winscp\winscp.com"
/script=c:\users\username\desktop\myscript.txt /log=c:\users\username\dedktop\log.txt

Then created a file named mysctipt.txt
It contains:
Option batch abort
Open sftplogin:sftppassword@example.com
Put test.txt /
Exit

Whe I run testscript.bat from dos prompt, it displays:
C:\users\username\desktop\>"c:\program files<86>\winscp.com"
Winscp> _
Basically waits....
?
Avatar of Sh M

ASKER

Well, ran it for 2nd time and this time it found the host but generated the exact same message as step A I followed initially...

Connection has been unexpectedly closed. Server sent command exit status 0.
Authentication log <see session log for details>:
Using username "my username".
Access denied.
Authentication failed.

Note that I use the exact same username and password to login through winscp GUI without any problem.
Avatar of Sh M

ASKER

Hello again!

I removed password and it started to work!!!!
When I use GUI it is impossible to connect!
Now the only problem is that I don't see the uploaded file in the GUI screen of winscp. Any suggestion?
You are putting the file to / at the destination, can you check there?

I'm changing to the correct folder in the script first (using cd ..) and then getting/putting the file.
Avatar of Sh M

ASKER

I don't have access to remote directory and can't create any folder. All I see is the root directory. I assume putting \ means root directory.
Avatar of Sh M

ASKER

I assume /test.txt will put the file under the root directory. Right?
You don't have access to the remote directory? How do you want to put files there then?