Announcement

Collapse
No announcement yet.

Using DIR$ below top directory?

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

  • Using DIR$ below top directory?

    I know how to use DIR$ so that it returns filenames. I would like
    to count the number of files (not directories) on a CD / DVD.
    Is it possible to use DIR$ so that it automatically goes to each
    subdirectory and I can count the files there?

    Thank you.

    Robert

    ------------------

  • #2
    Originally posted by Robert Carneal:
    Is it possible to use DIR$ so that it automatically goes to
    each subdirectory...
    In a word, no. During the DIR$ sequence, you will have to
    identify the subdirectry (Attrib=16) then CHDIR to switch
    directories.

    Counting files in a subdirectory is easy
    Code:
    mask$ = "*.*"
    counter = 0
    attribute = 8
    
    te$ = dir$(mask$,attribute)
    do until te$ = ""
    incr counter
    te$ = dir$
    loop
    print;counter
    Check the documentation to find uses of the attribute option.


    ------------------


    [This message has been edited by Mel Bishop (edited July 29, 2003).]
    There are no atheists in a fox hole or the morning of a math test.
    If my flag offends you, I'll help you pack.

    Comment


    • #3
      See the FILEFIND.BAS example.

      ------------------
      Tom Hanlin
      PowerBASIC Staff

      Comment


      • #4
        For PB-DOS 3.5, it's "findfile.bas" not "filefind.bas"

        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment

        Working...
        X