check for today''s file on ftp server. if exist, then download else, restart job 30 mins later

  • okay. i have researhced this for two days. i give up!

    what i an trying to do is to connect to my ftp server and check for current days' file. by checking date created. of date modified. if it exists, then download file. if not, then restart the job 30 minutes later going through thesame steps, until the file is found.

    any ideas?

    [font="Comic Sans MS"][/font]It is what it is.

  • Does the file have a unique name for today's file as opposed to yesterday's file or is it the same name being replaced each day?  No way I know of to get info on the file without pulling the file first but there are other ways around it.


  • Something along these lines?

    http://www.databasejournal.com/features/mssql/article.php/1459691

    -------------------------------------------------------------------------
    Normal chaos will be resumed as soon as possible. :crazy:

  • thansk for the response. it actually comes over as ddmmyynameoffile.txt. i tried parsing out the date to get the name and use active x and dynamic task in the dts package. it give a "success message" but the file does not come over.

    [font="Comic Sans MS"][/font]It is what it is.

  • How are you downloading the file from the ftp server?

    -------------------------------------------------------------------------
    Normal chaos will be resumed as soon as possible. :crazy:

  • post the code you are using to parse the name.

    Are you using the ftp task or the execute command task to get your file?

     


  • i am suing the ftp task. i know this is weird but i actually just deleted that part of the code this morning .

     

    but the idea,

     

    im MyDate, MyFile1 , Myday ,MyMonth , MyYear, mycday, mycmonth

                     MyDay  = day((now()-1))

                  If Len( MyDay) < 2  Then

                     MyCDay = "0"&Myday

                  Else

                      Mycday  =  myday

                  End If

                            

                     MyMonth  = Month((now()-1))

                  If Len( MyMonth) < 2  Then

                     MyCMonth = "0"&MyMonth

                  Else

                      MycMonth  =  MyMonth

                  End If

          MyDate= mycmonth & Right(CStr(Year(Now)),2)

        

    then i set global variable (sourcename).value  = filenamemtdate.txt

    somthing along those lines.

     

    his is the code below.

    [font="Comic Sans MS"][/font]It is what it is.

  • if you look at the global variable after you set it does it look right?  Also what ftp paramters are you using and what does the ftp script look like?


  • this might sound silly but try adding 3 semi colons to the end of the file name string (";;;")

     

     

  • You're probably right. I built some DTS packages a couple weeks ago that use a Dynamic Properties Task to read a configuration table that contains the path to some import files used in an FTP task. Initially, I set the SourceFileName property of the task to the file name stored in the table and the FTP step failed. When I looked closely at the default value for the property, it was a semicolon-delimited value that contained the file name (enclosed in single quotes), an empty string (I assume the file attributes, also in single quotes), and the file size. When I changed the output of the query to format the file name with the quotes and semicolons ("'filename.txt';;;"), the task succeeded.

    --Andrew

  • I have found that using the executable task to execute http://ftp.exe with a script file works better than the ftp task.  It allows you to do more within the ftp session.


  • I agree with mrpolecat. I can't say that I have used the FTP DTS task very much, but I would say that you could do all of this through a SQL script without using DTS.

    I would try a different route and setup a script that pulls the dir of the folder where the file is into a text file. Then you can BCP that file into a table with a single column of CHAR(500) or something like that. Then just do a select on that table to see if any of the filenames are the date that you are looking for. I have done this before and it works fine.

    I like DTS, but it sounds like you are making it into a more complex problem than it needs to be.

    Hope I helped.


    Live to Throw
    Throw to Live
    Will Summers

  • i wll try it

    thanks

    [font="Comic Sans MS"][/font]It is what it is.

Viewing 13 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic. Login to reply