directory.getfiles

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • frogman7

    #1

    directory.getfiles

    directory.getfi les(path, "*.htm") finds .htm and .html files
    same if you are looking for .c it finds .css also

    is there a fuction that just gets the file extention specified?

  • Cor Ligthert [MVP]

    #2
    Re: directory.getfi les

    Yes,

    http://msdn2.microsoft.com/en-us/library/wz42302f.aspx

    Cor

    "frogman7" <frogman7@googl email.comschree f in bericht
    news:1160095109 .342838.279550@ h48g2000cwc.goo glegroups.com.. .
    directory.getfi les(path, "*.htm") finds .htm and .html files
    same if you are looking for .c it finds .css also
    >
    is there a fuction that just gets the file extention specified?
    >

    Comment

    • frogman7

      #3
      Re: directory.getfi les

      AFter reading the doc it looks like i will have to try a different
      approach

      i want the user to be able to search for *.htm and only get the files
      that have an htm extention not the html files. so i will have to add
      some code to see if they only want the htm files and just return
      thoses.

      if you have any suggestions please let me know

      Comment

      • gene kelley

        #4
        Re: directory.getfi les

        On 5 Oct 2006 21:32:35 -0700, "frogman7" <frogman7@googl email.comwrote:
        >AFter reading the doc it looks like i will have to try a different
        >approach
        >
        >i want the user to be able to search for *.htm and only get the files
        >that have an htm extention not the html files. so i will have to add
        >some code to see if they only want the htm files and just return
        >thoses.
        >
        >if you have any suggestions please let me know
        One way -
        This Mainpages folder contains a mix of files with .htm & .html extensions.

        The resulting displayed listbox displays only the files with the .htm extensions.

        Dim di As New DirectoryInfo(" E:\Web Projects\Mainpa ges")
        Dim fi As FileInfo() = di.GetFiles("*. htm")
        For Each fiTemp As FileInfo In fi
        If fiTemp.Extensio n = ".htm" Then
        Me.ListBox1.Ite ms.Add(fiTemp.N ame)
        End If
        Next


        Gene

        Comment

        • frogman7

          #5
          Re: directory.getfi les

          what i am trying to do is something similar to the search that windows
          does to find files and folders. I am putting a start directory and
          want to find all the file (including the files in the sub folders) so i
          can write each line to a master file. i have it working but it uses
          loops and it extremely slow. Is there a function that grabs all the
          files from a folder and subdirecies?

          Comment

          • iqubal@gmail.com

            #6
            Re: directory.getfi les


            Do it Like this
            FileInfo Myfile = new FileInfo(strFil es[i]);
            if (Myfile.Extensi on.Length==4)
            {

            }

            Comment

            Working...