FSO FileExists Method

Ask a Question related to ASP, Design and Development.

  1. #1

    Default FSO FileExists Method

    I would like to know if I'm correct in the way I coded this:

    Function CheckFileExists(sFileName)
    If (fs.FileExists(sFileName)) Then
    CheckFileExists = True
    Else
    CheckFileExists = False
    End If
    End Function

    If CheckFileExists(Whichfolder & flindex & ".tif") Then
    'java code to display the tif inline with the browser
    else
    'code stating there is no file to display
    End if

    I just want to make sure that (Whichfolder & flindex & ".tif") which is an
    actual file path is what is being passed to the Function CheckFileExists as
    sFileName

    Thanks from this ASP Newbie


    David P. Jessup Guest

  2. Similar Questions and Discussions

    1. Is creationComplete=method() or initialize=method() theright solution for such kind of problem or ...?
      Hi everybody, I am using web service in my flex application and I want to visualize some data from collection of objects taht I receive from my Web...
    2. FileExists
      I know you can use FileExists to check for a file on a local machine but was wondering how you can check for a file on one that is located on a...
    3. FileExists Function Broken?
      I can't get the FileExists Function to work. Here is the code: <cfset abs_path = "W:\#log_dir#000\#log_image#"> <cfif FileExists("abs_path")> <a...
    4. method name exists, property value exists, calling method fails
      I have a class object I am calling in another class: class Stuff { var $myObj; function Stuff($myObj) { $this->myObj = $myObj; }
    5. Scripting.FileSystemObject - FileExists - Permission Denided
      Thank you for your reply. Now I changed the Directory Security to Anonymous ONLY with a domain user name and password. It passed "FileExists"...
  3. #2

    Default Re: FSO FileExists Method

    Hi David,

    That should work, although you don't really have to encapsulate it in a
    function like that. You can just do:


    If fs.FileExists("C:\Path\file.xt") Then
    '''code
    Else
    '''code
    End If

    Ray at work

    "David P. Jessup" <davidATimntDASHtechDOTcom> wrote in message
    news:%23TIP4tlkDHA.2456@TK2MSFTNGP09.phx.gbl...
    > I would like to know if I'm correct in the way I coded this:
    >
    > Function CheckFileExists(sFileName)
    > If (fs.FileExists(sFileName)) Then
    > CheckFileExists = True
    > Else
    > CheckFileExists = False
    > End If
    > End Function
    >
    > If CheckFileExists(Whichfolder & flindex & ".tif") Then
    > 'java code to display the tif inline with the browser
    > else
    > 'code stating there is no file to display
    > End if
    >
    > I just want to make sure that (Whichfolder & flindex & ".tif") which is an
    > actual file path is what is being passed to the Function CheckFileExists
    as
    > sFileName
    >
    > Thanks from this ASP Newbie
    >
    >

    Ray at Guest

  4. #3

    Default Re: FSO FileExists Method

    You could always check with some basic debugging:


    Function CheckFileExists(sFileName)
    response.write "Filename is " & sFileName
    ...

    > I just want to make sure that (Whichfolder & flindex & ".tif") which is an
    > actual file path is what is being passed to the Function CheckFileExists
    as
    > sFileName

    Aaron Bertrand - MVP Guest

  5. #4

    Default Re: FSO FileExists Method

    Thanks Ray

    "Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
    news:%23q7trylkDHA.1084@tk2msftngp13.phx.gbl...
    > Hi David,
    >
    > That should work, although you don't really have to encapsulate it in a
    > function like that. You can just do:
    >
    >
    > If fs.FileExists("C:\Path\file.xt") Then
    > '''code
    > Else
    > '''code
    > End If
    >
    > Ray at work
    >
    > "David P. Jessup" <davidATimntDASHtechDOTcom> wrote in message
    > news:%23TIP4tlkDHA.2456@TK2MSFTNGP09.phx.gbl...
    > > I would like to know if I'm correct in the way I coded this:
    > >
    > > Function CheckFileExists(sFileName)
    > > If (fs.FileExists(sFileName)) Then
    > > CheckFileExists = True
    > > Else
    > > CheckFileExists = False
    > > End If
    > > End Function
    > >
    > > If CheckFileExists(Whichfolder & flindex & ".tif") Then
    > > 'java code to display the tif inline with the browser
    > > else
    > > 'code stating there is no file to display
    > > End if
    > >
    > > I just want to make sure that (Whichfolder & flindex & ".tif") which is
    an
    > > actual file path is what is being passed to the Function CheckFileExists
    > as
    > > sFileName
    > >
    > > Thanks from this ASP Newbie
    > >
    > >
    >
    >

    David P. Jessup Guest

  6. #5

    Default Re: FSO FileExists Method

    Heh,
    Thanks Aaron, you proved why I use the sig: Thanks from this ASP NEWBIE =)

    "Aaron Bertrand - MVP" <aaron@TRASHaspfaq.com> wrote in message
    news:%23UnHX3lkDHA.2268@TK2MSFTNGP12.phx.gbl...
    > You could always check with some basic debugging:
    >
    >
    > Function CheckFileExists(sFileName)
    > response.write "Filename is " & sFileName
    > ...
    >
    >
    > > I just want to make sure that (Whichfolder & flindex & ".tif") which is
    an
    > > actual file path is what is being passed to the Function CheckFileExists
    > as
    > > sFileName
    >
    >

    David P. Jessup Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139