Upload files from windows location to Unix FTP server location

Hi,

  I have a windows server 2012, where the location "D:\BR_Reports\FTP_Files\Test" will get a file with a filename that changes every day.
I'm trying to upload this file to an FTP location, "app/BR/EntPrs/Adhocs".
But when i save the below code as a bat file, and invoke it through Winscp, it's not uploading the file.
Can someone kindly help me resolve this issue?

option batch abort
option confirm off
echo off
open sftp://Buser_Name:B_Password@1.1.3.131 -hostkey="ssh-rsa 1024 

60:19:e6:8c:f3:0b:e8:73:90:47:bc:78:a2:ca:c3:c6"
option transfer ascii
                   
PUT    'D:\BR_Reports\FTP_Files\Test\*.txt'                 
      	app/BR/EntPrs/Adhocs/*.TXT                 
close
exit

Open in new window

pvsbandiAsked:
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.

Tom CieslikIT EngineerCommented:
Try this
LCD D:\BR_Reports\FTP_Files\Test\
PUT    *.txt /app/BR/EntPrs/Adhocs/*.TXT


Or if is not works

Try this
CD /app/BR/EntPrs/Adhocs
LCD D:\BR_Reports\FTP_Files\Test\
PUT    *.txt

I assume /APP is your root folder, if not use full path from Home to Adhocs   - like   /home/......./Adhocs
0
pvsbandiAuthor Commented:
Sorry, didn't work. Didn't do anything, when i ran the bat file.
My bat file has this command, pointing to the file "WinSCP_FTP.txt", which has the content from my original post.
"C:\Program Files (x86)\WinSCP\WinSCP.com" -D:\BR_Reports\FTP_Files\WinSCP_FTP.txt

Open in new window


Any other pointers?
0
Tom CieslikIT EngineerCommented:
"C:\Program Files (x86)\WinSCP\WinSCP.com" /command /script=D:\BR_Reports\FTP_Files\WinSCP_FTP.txt
and use your own txt file.

Or
Try run WinSCP and put commands manually.
Then you'll get error if there is something missing.
It will be much better to find the problem.

If you do then you can modify WinSCP_FPT.txt file
0

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
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

pvsbandiAuthor Commented:
Thank you!
   It is now throwing the error "Host D: doesn't exist"
I guess, it's not able to navigate from C:\ to invoke D:\
Can someone help me overcome this issue?
0
pvsbandiAuthor Commented:
Thank you! your suggestion led me to the solution.
0
pvsbandiAuthor Commented:
Host D doesnt exist issue was because there was a space between = and D
0
Tom CieslikIT EngineerCommented:
You are very welcome :)
0
pvsbandiAuthor Commented:
May I ask a little follow up question?
How to invoke this script in a silent mode? It is opening the dos window every time.
0
Tom CieslikIT EngineerCommented:
0
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
FTP

From novice to tech pro — start learning today.