Check files If exists or if not exists

  • Hi all ,

    I have to check for files are exists or not,I have a table which contains filenames and i want to check for each file wether it is exists or not,Can any one help me on this ,

    Regards..
    guru12

  • Why not use the IF EXISTS

    Satnam

  • Hi ,

    I have to create an ssis package regarding this,can you please explain me briefly on this.

    Regards..
    guru12

  • What happens once you've verified that the file exists (or not)?

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • Hi all,

    Actual my requirement is like this,

    I have a table which lists the list of text files, for which I have to check if they exist on the file share. Say for example I have test1.txt, test2.txt, test3.txt etc. I have to check to see if test1.txt is present on the file share, if so, grab it and process the file. If test1.txt is not present, move on to find out if test2.txt is present, if it is present process the file, if it is not present on the file share, move on to see if the next file, which is test3.txt is present on the file share..

    Please,Can any one suggest on this.Its very urgent

    Regards..
    guru12

  • I find the easiest way to check for files is to use a script task and the File.Exist method

    http://msdn.microsoft.com/en-us/library/system.io.file.exists.aspx

  • can you please explain in brief how to use,we have to script task in any loop container

    Regards..
    guru12

  • have a look at this link for instructions on getting file.exists to work in SSIS

    http://dichotic.wordpress.com/2006/11/01/ssis-test-for-data-files-existence/%5B/url%5D

    to work with a loop i would just map the FileExists variable from the script to ValExpression of the loop

  • I'm guessing that there can be a lot of files in this share that you do not wish to process?

    An alternative solution may be to nominate a folder on the file share as the 'SSIS Input' folder (or whatever) and then to dump any of your text files which are ready to be processed in there.

    Then use a foreach loop in your package to process *.txt in that folder (and archive them after processing). That way, you don't need to keep track of file names quite so rigorously.

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

Viewing 9 posts - 1 through 8 (of 8 total)

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