FTP BAT file - Windows Scheduled Task

21,016

Solution 1

See my question for the correct script; thanks @djhowell - your script got me started:

Here's the working script:

open ftp.yoursite.com
ftpUsername
ftpPassword
lcd C:\Temp\OrWhatever
cd /DirectoryOnFtpServer
prompt
mget *.*
quit

lcd - change LOCAL directory
cd - change REMOTE directory
mget *.* - get all files in directory

Solution 2

Yes, it's possible using scripting mode (ftp -s). Put something like this in a .BAT file:

ftp -s:MyFTP.txt

And then create a MyFTP.txt file in the same path that contains something like this:

open ftp.example.com
myusername
mypassword
lcd C:\Backup
mget *
quit

Or specify multiple directories like

mget httdocs\*
mget subdomains\*
Share:
21,016

Related videos on Youtube

want help
Author by

want help

Updated on September 17, 2022

Comments

  • want help
    want help almost 2 years

    Is it possible to create a scheduled task in windows, that connects to an FTP site, and downloads all the files and folders within the root directory (or specified folders in the root directory) - for example \httdocs and \subdomains to a local directory?

    I figure it must be possible, however i can't quite think of the syntax....

    This is to backup my website, to the local drive - i edit and upload content to it (it's wordpress) from various sources.

    • Richard
      Richard over 14 years
      @alex: as per your comment for @djhowell: click RUN > cmd ... type in ftp ... see what happens ... if you get ftp> prompt - your script should work just fine ... if not - you don't have c:\windows\server32 n your path
  • want help
    want help over 14 years
    i tried this, when i execute the bat file, it just prints ftp -s:MyFTP.txt over and over..... it doesn't seem to try and connect....
  • Admin
    Admin about 13 years
    Don't call your batch file "ftp.bat", because windows doesn't know whether to call ftp.bat or ftp.exe. Name your batch file something like "ftpfiles.bat". thread necro FTW!