• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need script to copy file on FTP server from Windows

 
Ghulam Rashid
Ranch Hand
Posts: 278
  • Mark post as helpful
  • send pies
  • 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
 
Peter Rooke
Ranch Hand
Posts: 851
1
Java Linux Spring
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
But, it requires to download and install 3rd Party tool.
Is there something from Window, itself?
 
Peter Rooke
Ranch Hand
Posts: 851
1
Java Linux Spring
  • Mark post as helpful
  • send pies
  • 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.
 
Kevin Wright
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can also use .netrc to store usernames and password. The rest appears easy to script using *nix tools.
 
Brian Wright
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
FTP has it's own scripting capability - check that out first, I'd suggest.
 
Syedz -X-
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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!!
 
Vijay Vaddem
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • 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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic