Check Files existence in a folder

  • Hi All,

    how to implement the below req in SSIS:

    how to find out whether any file is present in the specified folder.

    Note: we dont know about the file name. Just we need to check whether any files present or not.

    Thanks in Advance.

  • It depends, largely.

    Please google WQL

    Raunak J

  • Depends on what you will do next.

    You might just be able to use a Foreach loop and put your 'file(s) found' processing inside it.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • You may find xp_fileexists extended stored procedure useful. More information on this XP here

    Pradeep Adiga
    Blog: sqldbadiaries.com
    Twitter: @pradeepadiga

  • as another suggestion; the way we do it is to use a script task with the File.Exists Method

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

  • Adiga (11/2/2010)


    You may find xp_fileexists extended stored procedure useful. More information on this XP here

    The OP says, file name not known

    Raunak J

  • One of the suitable approach would be to watch the said directory using a FileSystemWatcher and fire appropriate events as associated. This seems doable as the system does not deems necessary for a filename to be known.

    Raunak J

  • Hi,

    Use Script Task go to design script

    U can write C# or VB Script for the same

    Cheers!

    Sasidhar Pulivarthi

  • Pulivarthi Sasidhar (11/2/2010)


    Hi,

    Use Script Task go to design script

    U can write C# or VB Script for the same

    Cheers!

    Sasidhar Pulivarthi

    What does this give the OP that Steveb's post did not?

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Phil Parkin (11/2/2010)


    Pulivarthi Sasidhar (11/2/2010)


    Hi,

    Use Script Task go to design script

    U can write C# or VB Script for the same

    Cheers!

    Sasidhar Pulivarthi

    What does this give the OP that Steveb's post did not?

    In any case, File.Exists() cannot be used :-):-):-)

    Raunak J

  • True 🙂

    Directory.GetFiles will probably do the job.

    But so will a FEL, without the need for any code.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Think Big...Think Windows Service that will poll a directory implementing Windows Management Instrumentation Events..lol...

    Yes Phil FEL can be used but the ST has to invlove a suitable code for threading to minimize the resource usage for all the time as long as file is not found...So a better approach should be a WQL/FileSystemWatcher as it will keep the package in dormant state as long as file is not found at the designated root folder.;-)

    Raunak J

  • You are using a lot of guesswork here.

    A quote from the original post:

    how to find out whether any file is present in the specified folder.

    Note: we dont know about the file name. Just we need to check whether any files present or not.

    ..and that's it.

    You have somehow extrapolated an extravagant requirement from this. Maybe the check needs to be done only once a day/week/month - who knows?

    I suspect you have the geek-defect gene installed 🙂

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Phil Parkin (11/2/2010)


    You are using a lot of guesswork here.

    Somehow, I don't think so. 🙂

    Raunak J

  • Raunak Jhawar (11/2/2010)


    Think Big...Think Windows Service that will poll a directory implementing Windows Management Instrumentation Events..lol...

    Yes Phil FEL can be used but the ST has to invlove a suitable code for threading to minimize the resource usage for all the time as long as file is not found...So a better approach should be a WQL/FileSystemWatcher as it will keep the package in dormant state as long as file is not found at the designated root folder.;-)

    A VB task could very quick get a count of the files in a directory.



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

Viewing 15 posts - 1 through 15 (of 15 total)

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