FTP Batch Script to Backup Website

Sharky Forums


Results 1 to 6 of 6

Thread: FTP Batch Script to Backup Website

  1. #1
    Tiger Shark Thraner's Avatar
    Join Date
    Sep 2001
    Location
    Parma, OH USA
    Posts
    809

    FTP Batch Script to Backup Website

    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!!!
    Thraner

  2. #2
    Hammerhead Shark e_dawg's Avatar
    Join Date
    Jan 2001
    Location
    Earth, Western Hemisphere, North America, US, UT, SLC
    Posts
    2,628
    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).

  3. #3
    Tiger Shark
    Join Date
    Mar 2001
    Posts
    615
    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:

    Code:
    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.
    System specs:


    | Core i5 750 | GA-P55A-UD3 | 4.0 GB G.skill DDR3 1600 | eVGA 470 GTX |
    | Intel X25-M 80 GB SSD | WD 5000AAKS | Lian Li PC-7FN | Corsair TX750W |
    | Windows 7 Home 64-bit |

  4. #4
    Tiger Shark Thraner's Avatar
    Join Date
    Sep 2001
    Location
    Parma, OH USA
    Posts
    809
    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!
    Thraner

  5. #5
    Super Bunny Mod muisejt's Avatar
    Join Date
    Dec 2000
    Location
    Nova Scotia, Canada
    Posts
    9,833
    wget is available in Windows binaries, http://wget.sunsite.dk/

    there is also HTTrack, http://www.httrack.com/index.php
    If your sig is longer than your post then type more.

  6. #6
    Tiger Shark Thraner's Avatar
    Join Date
    Sep 2001
    Location
    Parma, OH USA
    Posts
    809
    Thanks a mint! I'll try one or both of them this weekend!!
    Thraner

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •