Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Straight forward FTP process 1

Status
Not open for further replies.

keepingbusy

Programmer
Apr 9, 2000
1,470
GB
Hello

I have been looking at various scripts from a Google search but cannot for the like of me get this thing working.

I am simply trying to open an FTP site and download a file from it.

Here is an example I found:

Code:
FTP -v -i -s:ftpscript.txt
In the text file:
open example.com
username
password
!:--- FTP commands below here ---
lcd c:\MyLocalDirectory
cd  public_html/MyRemoteDirectory
binary
mput "*.*"
disconnect
bye

I changed the relevant lines but it just wont work.

So for example, my details would be something like:

Code:
URL: ftp://ftp.xxx.xxx/myfolder/
myusername
mypassword
lcd c:\mydownloadfolder
mput thefileiwant.txt
disconnect
bye

Can anyone shed some light on this or point me in the right direction please?

I am using Windows 7 Home Premium with Service Pack 1

Many thanks
 
Take the pain out of it with something like:




ACSS - SME
General Geek



1832163.png
 
Hi

Thanks for posting the link which I will look at and post back.
 
Or you could use something like filezilla, or even the windows 7 built in ftp client. Taken from Revision 3:

While not as robust as a full dedicated client like FileZilla, if you simply need to transfer some files in a pinch Windows 7 offers a pretty decent built-in FTP client.

The site setup is hidden underneath the map network drive dialog, but once setup connecting to an FTP site is as easy as opening a drive or folder.

From the Comptuer folder press ALT on your keyboard to display the toolbar. Click Tools, the Map Network Drive. Click the link labeled Connect to a Web site that you can use to store your documents and pictures - this will launch a new wizard.

Follow the prompts selecting Custom network location. Enter ftp:// followed by your server's domain or IP and click next. On the following screen enter your username is necessary and click next twice, then finish.

You will then be prompted for your FTP account password. After logging in you can drag-and-drop files to and from your FTP server just like you would any other folder.
 
rclarke250

Thanks for your post but we are hoping to do this automatically and on the hour using Windows Scheduler with some other code we are compiling.

Will post back

 
Hi keepingbusy,

You are trying to download a file from the remote server?

If so, then replace mput thefileiwant.txt with get thefileiwant.txt in the script file.

Regards,
Richard.
 
Richard

Thanks for the post.

All,

I still cannot connect to the ftp server. I have tried different combinations such as (at the C:\ prompt):

Code:
FTP
open ftp://ftp.xxx.xxx/myfolder/
open ftp.xxx.xxx/myfolder/

The message I am getting is unknown host

If I type ftp://ftp.xxx.xxx/myfolder/ in the browser address bar, I go straight to the required ftp folder (after I enter the user name and password of course).

Still not sure why I cant connect. Any suggestions guys?
 
for the open command, you should not be specifying the folder, you use the cd command for that

C:\Users\justin\Desktop>type test.txt
open myftphost
user myuser
secretpassword
cd myfolder
dir
hash
binary
get myfile.zip
quit

C:\Users\justin\Desktop>ftp -n -s:test.txt
 
As in above post, the open command should be open ftp://ftp.xxx.xxx.

Regards,
Richard.
 
Hello guys

Thanks for all the posts. I'm hoping to sit down this evening and try out your suggestions.
 

Hi guys

Apologies for not getting back sooner but this is what I have that is working and downloads the required file to our computer if I enter each manually at the DOS prompt:

Code:
cdcd ourfolder
ftp ftp.xxxxxxxx.com
myusername
mypassword
cd reportfolder
binary
get mytextfile.txt
bye
exit

I have put the above into a .bat file (mybatchfile.bat) but when I run it, it asks me for the user name and password and also stops at each line.

I'm not that familar with batch files, any guidance please?

Many thanks
 
Sorry, just stumbled across this extra piece of code that is now working:

I changed my command lines in the .bat file and saved it to a txt file.

Code:
[b]open[/b] ftp.xxxxxxxx.com
myusername
mypassword
cd reportfolder
binary
get mytextfile.txt
bye
exit

I then ran the following:

Code:
C:\ftp  -i -s:mybatchfile.txt

ftp site opens and allows me to download the file we require.

Many thanks to those who posted on the thread.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top