Asheeown Posted January 21, 2007 Share Posted January 21, 2007 I have a program that gets a file from a website ungzips it and inputs that data into the database, however I would like to put this file onto a cron job and have it download the most recent file that hasn't already been downloaded.Just say it if you need any more detail to fully understand Quote Link to comment Share on other sites More sharing options...
kevinkorb Posted January 21, 2007 Share Posted January 21, 2007 I understand the process... Can you provide any naming conventions used and how you're downloading the new files? Quote Link to comment Share on other sites More sharing options...
Hypnos Posted January 21, 2007 Share Posted January 21, 2007 Make another SQL table to log file names and size. Check the file size and name, and if it matches one of the ones in the database, don't insert it. Quote Link to comment Share on other sites More sharing options...
Asheeown Posted January 21, 2007 Author Share Posted January 21, 2007 These are provided by the company we use for tracking[quote]cdr_20070121000000-daily.csv.gz[/quote]the name includes the the year first "2007", in this case, then the month "01", in this case, then it has a unique id after the month and that would be "21" for this one Quote Link to comment Share on other sites More sharing options...
Asheeown Posted January 22, 2007 Author Share Posted January 22, 2007 so....any ideas? Quote Link to comment Share on other sites More sharing options...
linuxdream Posted January 22, 2007 Share Posted January 22, 2007 Depending on how you get the file, you could just check the time stamp or atime of the files. Might be a little easier than comparing the filenames...but not by that much. Quote Link to comment Share on other sites More sharing options...
Asheeown Posted January 22, 2007 Author Share Posted January 22, 2007 Well I can use a database table to compare what i'm downloading but the problem is downloading files that I'm not even sure are there.Meaning when you do a file script and plain and simple call the file by saying file(file.gz) but when I want to run this script on a cronjob and have it automated how will php get all the file names from the directory? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.