The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Cron Job Download New Version of File

Discussion in 'General Discussion' started by Graham Ferguson, Feb 17, 2015.

  1. Graham Ferguson

    Graham Ferguson Registered

    Feb 17, 2015
    Likes Received:
    Trophy Points:
    Dunfermline, Fife, United King
    cPanel Access Level:
    Website Owner
    Hello, I need some help on how to download a file using a cron job.

    I need to download a file from an ftp address on a separate server, get the file and put it in a particular directory on the server. I also only want to grab the file if the version on the FTP server is newer than the version on my server.

    I am currently able to pull the file into the required directory but cannot get it to only do this if the file is newer, the command line I am using is:

    wget ftp://ftpaddress/data/item_import_prod_features.txt -O /serveraddress/item_import_prod_features.txt
    Could someone tell me how I can do that please?
    #1 Graham Ferguson, Feb 17, 2015
    Last edited by a moderator: Feb 17, 2015
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Apr 11, 2011
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator
    Hello :)

    You could use cURL as documented here:

    cURL - Manual

    Search for the term "remote file is newer" in your browser on the above page to see which commands are available.

    Thank you.

Share This Page