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 Link to comment https://forums.phpfreaks.com/topic/35116-file-getting-under-conditions/ 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? Link to comment https://forums.phpfreaks.com/topic/35116-file-getting-under-conditions/#findComment-165740 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. Link to comment https://forums.phpfreaks.com/topic/35116-file-getting-under-conditions/#findComment-165744 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 Link to comment https://forums.phpfreaks.com/topic/35116-file-getting-under-conditions/#findComment-165752 Share on other sites More sharing options...
Asheeown Posted January 22, 2007 Author Share Posted January 22, 2007 so....any ideas? Link to comment https://forums.phpfreaks.com/topic/35116-file-getting-under-conditions/#findComment-166088 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. Link to comment https://forums.phpfreaks.com/topic/35116-file-getting-under-conditions/#findComment-166099 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? Link to comment https://forums.phpfreaks.com/topic/35116-file-getting-under-conditions/#findComment-166106 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.