• Status: Solved
  • Priority: High
  • Security: Private
  • Views: 33
  • Last Modified:

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

0
pvsbandi
Asked:
pvsbandi
  • 5
  • 4
1 Solution
 
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
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now