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
shmzAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gerwin Jansen, EE MVETopic Advisor Commented:
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?
shmzAuthor Commented:
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?
BudDurlandDirector of ITCommented:
In your WinSCP folder should be a "winscp.COM".  Try using that instead of the .EXE
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

Gerwin Jansen, EE MVETopic Advisor Commented:
Don't use /command etc, use /script instead.

For example: winscp /script=c:\path\your_script.scp /log=c:\path\log\your_script.log >nul

where your_script.scp could contain:

open your_connection
cd /incoming/input
get *.xml
exit

That your_connection in the script is referring to an existing connection in WinSCP that either uses SSH keys or stored password. In case you were to overwrite existing files on the remote server you should add option confirm off in the script file.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
shmzAuthor Commented:
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.
shmzAuthor Commented:
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.
Gerwin Jansen, EE MVETopic Advisor Commented:
>> 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.
shmzAuthor Commented:
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....
?
shmzAuthor Commented:
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.
shmzAuthor Commented:
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?
Gerwin Jansen, EE MVETopic Advisor Commented:
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.
shmzAuthor Commented:
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.
shmzAuthor Commented:
I assume /test.txt will put the file under the root directory. Right?
Gerwin Jansen, EE MVETopic Advisor Commented:
You don't have access to the remote directory? How do you want to put files there then?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.