• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Need script to copy file on FTP server from Windows

 
Ranch Hand
Posts: 278
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Need script to copy file on FTP server from Windows


Set of files are on FTP server in a folder. I need a script that:

- logins to ftp server
- copy a file from one folder to another
- mget the file to windows
- then bye

I want to run this job from the windows bat file.

Thank you
 
Bartender
Posts: 1158
20
Mac OS X IntelliJ IDE Oracle Spring VI Editor Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You may be best to have a look at the Expect utility. You can a windows version.
 
Ghulam Rashid
Ranch Hand
Posts: 278
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But, it requires to download and install 3rd Party tool.
Is there something from Window, itself?
 
Peter Rooke
Bartender
Posts: 1158
20
Mac OS X IntelliJ IDE Oracle Spring VI Editor Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't know - problem you have is with programs that require passwords (ie ftp), is that you have to simulate keyboard entry. That is what expect does for you.

You could write it in Java.
 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can also use .netrc to store usernames and password. The rest appears easy to script using *nix tools.
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
FTP has it's own scripting capability - check that out first, I'd suggest.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For ftp'ing files/dir from windows box you need to create two files

1) a .bat files contain everthing you need and this line

ftp -in < autoftp

2) file called autoftp with this as a content

open 192.168.1.3 <--your ip
user root abc123 <--username and passwd
verbose
type ascii
hash
cd /home/syedz <-- remote dir
pwd
lcd /root/ftp_test <-- local dir
mput *
bye


DONE!!
 
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If required, you may use ant script to do this....
This will be helpful for both windows and linux...

I was unable to copy the ant task here...
it is showing partially.... something to do with the tags...

[ August 30, 2006: Message edited by: Vijay Vaddem ]
[ August 30, 2006: Message edited by: Vijay Vaddem ]
 
CAUTION! Do not touch the blades on your neck propeller while they are active. Tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic