Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

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 Technical Support Community Manager
    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.
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice