Click to See Complete Forum and Search --> : FTP Batch Script to Backup Website


Thraner
09-11-2002, 04:56 PM
Hi guys, I am looking to create a Windows batch (.bat) file to backup my Website. I have searched a million sites on how to create this, and I am a little lost. Let me show you what I have so far (details removed, of course):

ftp ftp.myhost.com

#wait here 3 secs

myusername

#wait here 3 secs

mypassword

#wait here 3 secs

cd \(the directory i want to download from)

#wait here 6 secs

getdir thedirectory


I don't actually know how to make it wait, but I thought the command was 'wait' or 'pause'. The other problem is, I want to get a directory and all subdirectories, all files in those, and I want to overwrite what is on my local machine. I know that to download to a certain directory on my machine, I need to run the script from that directory, or add a line like (cd C:\thedirectory). Can someone please enlighten me?? Thanks in advance!!!

e_dawg
09-11-2002, 10:11 PM
I know this is a really stupid comment, but, I use wget to mirror sites under Linux. You might look for an equivalent for windows (might make your searches a bit more accurate).

Zoma
09-12-2002, 02:36 AM
As far as I know, you can't do this with a batch file, at least not how you are trying to. The batch file will wait until ftp.exe finishes executing before running the rest of your batch file. Take the following simple example:


ftp
bye


There are two obvious ways this could by handled:

1. The script executes ftp, then sends the "bye" command to ftp, causing it to quit.

2. The script executes ftp. Once you quit out of ftp, the script tries to execute "bye."

Batch files work like #2. It will start where it left off when it called ftp, which isn't what you want.

Thraner
09-12-2002, 08:13 AM
ok, I totally see what you're saying how it won't work like I want it to. I guess my next logical questions are:
1) Do you know of a good Windows equivalent of the software mentioned above?
2) Can something be written in Perl or VB to handle this?

I'm sure someone else has wanted to do this before.

Thanks for the replies so far though guys!

muisejt
09-12-2002, 02:35 PM
wget is available in Windows binaries, http://wget.sunsite.dk/

there is also HTTrack, http://www.httrack.com/index.php

Thraner
09-13-2002, 09:14 AM
Thanks a mint! I'll try one or both of them this weekend!!