Announcement

Collapse
No announcement yet.

Have a problem with DIR$

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Have a problem with DIR$

    Hello
    I have a problem with "DIR$".
    With the following procedure, I want to create a list of the names of all directories and files in a directory-X.
    I just get the filenames. Can someone tell me what I'm doing wrong?
    POWERBASIC = 10



    CASE %IDC_GO
    IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN
    i = 1
    CHDIR directory-X
    Liste(i) = "DIR: "+ DIR$("*.*" ,%SUBDIR )
    FOR i = 2 TO 99999
    Liste(i) = "DIR: " + DIR$(NEXT)
    IF Liste(i) = "DIR: " THEN EXIT FOR
    NEXT i


    Liste(i) = DIR$("*.*", 0 )
    FOR i = 2 TO 99999
    Liste(i) = DIR$(NEXT)
    IF Liste(i) = "" THEN EXIT FOR
    NEXT i
    END IF




    The directory-X contains the following:
    sounds (a directory)
    SHUTDOWN.bas
    SHUTDOWN.EXE
    shutdown.ico


    The results list shows the following:
    DIR: SHUTDOWN.bas
    SHUTDOWN.EXE
    shutdown.ico

  • #2
    your first DIR$ is returning both normal files and folders, but not in any particular order.
    You're assuming it returns only folders.

    Try adding the keyword ONLY in the first DIR$
    Code:
    Liste(i) = "DIR: "+ DIR$("*.*" ,ONLY %SUBDIR )

    Comment


    • #3
      ( ( ( ( ( ( Thank you ) ) ) ) ) )

      Comment

      Working...
      X