Hi,

I would like to know how do I download file automatically from remote host where my website resides to my computer at home at certain time. Say at 10 AM daily, a file will be download to my home pc. What software package do I need at home to set it up to receive a file? I'm using PHP & Linux.

Thanks,
John

    If you're using Linux, then setup a cron job to execute lynx or wget and the URL to download the file from (there's some other parameters you can or may need to specify).

      Thanks, but how do I set up server at home to receive file? What do I need?

        If you are using Linux, yes follow astrotegs method.

        For windows, this is what I do.

        Use Putty's PSFTP client.

        Create a batch file which log's on to the server, cd's to directory, get's the file

        Use scheduler to call the batch file when you want to.

        I do this each day for downloading server backup files.

        The server runs a cronjob which zips directories. My windows PC here starts a batch file each morning. The batch file downloads the backup.zip file.

          9 days later

          Thanks all. I didn't write clearly enough. What I need is Frank Rizzo answer because I has Windows at home, but using Linux & PHP at website hosting.

          BTW, Frank you wrote:

          Create a batch file which log's on to the server, cd's to directory, get's the file

          A dos batch file? Is there any tutorial, article on how to do this? I would like to have a sample of this code if possible.

          Thank you very much,
          John

            You will need to download psftp from here:

            http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

            Next, create a batchfile called download.bat or whatever you like

            psftp -b download.scr -pw yourpwd user@yoursite.com

            Where yourpwd is your ftp password and user is your ftp user for yoursite.com

            now create a file called download.scr (this is an ftp script file)


            cd /path_to_your_file/server_file
            lcd e:\downloads\server_file
            get server_file
            quit

            where /path_to_your_file/ is the location where the file is at, server_file is the file you want to download. I download to a directory on my e: drive called downloads so change that to whatever you want too.

            The next stage is to use windows scheduler to run the download.bat file everyday. Obviously, doing so each day will overwrite the previous downloaded files. You can use a more comprehensive batch file to rotate the last 10 files or so. Let me know and I'll post that too.

              Write a Reply...