Results 1 to 4 of 4
  1. #1
    Join Date
    September 7th, 2006
    Dealing with timestamp in filename

    I'm having some trouble getting started on this issue: I receive a CJ feed that gets pushed to my server. I requested that the five merchants included in my feed be split up as separate .csv files to work with my existing scripts. When I receive the feed from CJ, it's a single zip file containing those five files. I've got everything working to automate the process of unzipping the feed and populating my database, but I'm not sure how to deal with the timestamp in the .zip file name ( If I am to run my script from cron, I'm not sure how to make my script look for the new file name every time I receive a new feed.

    Can someone get me pointed in the right direction with this? I generally use PHP, but I'm not an expert.


  2. #2
    ABW Ambassador sjangro's Avatar
    Join Date
    January 17th, 2005
    In case it helps, here's a piece of a bash shell script that works for me.

    The date command works differenly in different *nix OSes, specifically the '-d yesterday', so it may not work exactly like this for you.

    yesterday_date=$(date -d yesterday "+%Y%m%d")
    today_date=$(date "+%y%m%d")
    #use yesterday_date or today_date depending on when this is run
    wget -q${yesterday_date}.zip
    if [ ! -s "xxxxx_xxxx_${yesterday_date}.zip" ]; then
        echo  "xxxxx_xxxx_${yesterday_date}.zip does not exist or is empty."
        unzip -o xxxxxx_xxxx_${yesterday_date}.zip 
        # process files here...

  3. #3
    ABW Ambassador Snib's Avatar
    Join Date
    January 18th, 2005

    I had the same problem. Just ask CJ for a static file name so you don't have to deal with the timestamping.

    - Scott
    Hatred stirs up strife, But love covers all transgressions.

  4. #4
    ABW Ambassador
    Join Date
    January 18th, 2005
    I usually create a script then call it using cron

    $ftp_feedID = "9999999_9999_";
    $feed_date = date("Ymd", mktime(0,0,0,date("m"),date("d")-1,date("Y")));
    $ftp_filename = "$ftp_feedID$";

  5. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Datafeed Filename Changes After Unzipping
    By Uncle Rico in forum Google Affiliate Network - GAN
    Replies: 8
    Last Post: June 24th, 2010, 05:54 PM
  2. Merchant Data file upload timestamp
    By leonusst in forum Rakuten LinkShare - LS
    Replies: 5
    Last Post: July 25th, 2007, 11:31 PM
  3. filename problem
    By insyncnet in forum WebMerge (
    Replies: 6
    Last Post: March 2nd, 2007, 04:16 PM
  4. Convert Unix timestamp to date
    By AcuraImport in forum Programming / Datafeeds / Tools
    Replies: 2
    Last Post: April 14th, 2005, 11:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts