IonicWind Software

IWBasic => General Questions => Topic started by: TexasPete on January 28, 2009, 10:36:44 AM

Title: A little more folder help
Post by: TexasPete on January 28, 2009, 10:36:44 AM
Below I am trying to read only the folders into the html file. I am just getting off of a lot of demeral from surgery. I am try to read and check for all sub folders only and put them in my array. I am usining instr to determine if there is a file extension or not. It still continues to read all the files . No matter is there is a period in the file name or not . What am I doing wrong?

filename = FINDNEXT(dir)
      '---This limits the type of File returned
                     PRINT filename," ", attrib
                     IF (filename <> ".")and (filename <> "..")
              if attrib =16  and instr(filename,".") < 1 then
                HtmlFiles[NoHtmlFiles]=filename   :NoHtmlFiles=NoHtmlFiles+1
                   PRINT "Sub FOLDERS ",filename," ", attrib
                            end if
                   ENDIF

Thanks a lot Texas Pete

Title: Re: A little more folder help
Post by: billhsln on January 28, 2009, 11:26:29 AM
This should work.

dir = FINDOPEN(path + "*.*")
IF(dir)
DO
filename = FINDNEXT(dir,attrib)
IF len(filename)
IF attrib & @FILE_DIRECTORY
IF(filename <> ".") & (filename <> "..")
HtmlFiles[NoHtmlFiles]=filename
                                        NoHtmlFiles++
ENDIF
ENDIF
ENDIF
UNTIL filename = ""
FINDCLOSE dir


Bill
Title: Re: A little more folder help
Post by: TexasPete on January 28, 2009, 12:37:40 PM
bILL,

  I did as you suggested and the following code resulted. Unfortunately, It is still reading all the files into the array instead of only the folders.

   DO
   
'--------------------------get html file names--------------
'-----------------------------------------------------------
'--------------------------------------------------------------
     filename = FINDNEXT(dir,attrib)
      '---This limits the type of File returned
        PRINT filename," ", attrib
      if len(filename)
         if attrib & @FILE_DIRECTORY
              IF (filename <> ".") &(filename <>"..")
               HtmlFiles[NoHtmlFiles]=filename   :NoHtmlFiles++
                PRINT "Sub FOLDERS ",filename," ", attrib
              end if
         ENDIF
      endif
  UNTIL filename = ""


If i missed something please let me know what I missed.

Thanks Texas Pete
Title: Re: A little more folder help
Post by: billhsln on January 28, 2009, 01:07:13 PM
Other values for Attrib:

@FILE_ARCHIVE
@FILE_COMPRESSED
@FILE_DEVICE
@FILE_DIRECTORY
@FILE_ENCRYPTED
@FILE_HIDDEN
@FILE_NORMAL
@FILE_READONLY
@FILE_SYSTEM

Could you send me more of the code you are using, so I could test it on my machine.  The code I sent before works on my PC.

Bill