Vbscript to check if there is any file in a folder

  • Hi,

    I am looking for a vbscript to check if there is any file in a folder, C:\test

    If there is a file there, then reture failure, and if there is a file there, then ruturn success.

    Thanks,

  • QQ-485619 (8/24/2010)


    Hi,

    I am looking for a vbscript to check if there is any file in a folder, C:\test

    If there is a file there, then reture failure, and if there is a file there, then ruturn success.

    Thanks,

    Are you sure that T-SQL and vbscript is the same thing? 😀

    Why not ask Assembly or FORTRAN question here? I think you will get a lot of help...

    Ok, you will need to use Scripting.FileSystemObject object, google it to find which exact method of it you can use...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • If it's to hard...

    Dim fso, f, f1, fc, s

    Set fso = CreateObject("Scripting.FileSystemObject")

    Set f = fso.GetFolder("C:\Work")

    Set fc = f.Files

    MsgBox( "Found " & fc.Count & " file(s)")

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

Viewing 3 posts - 1 through 2 (of 2 total)

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