1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed _DO_FILES and _DO_DIRS wrong

Discussion in 'Support' started by Steve Fabian, Aug 28, 2012.

  1. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    TCC 13.04.63 and 14.01.33 - WinXP SP3 - 32b

    Executing DO d in fileset.

    1/ _DO_FILES is not reset when a new DO command is executed
    2/ _DO_FILES is incremented by 1 more than the number of times through the loop
    3/ if fileset contains directories, they are counted in _DO_FILES and not in _DO_DIRS

    Executing DO d in /s fileset. with many subdirectories, one without files, others with one file each:

    _DO_DIRS remains zero!

    Executing DO d in /a:-d /s fileset (same tree):

    _DO_FILES counts directories even though they do not match the specifications

    Not tested: behavior of _DO_FILES when members of fileset are excluded by range specification.

    Documentation nits:
    - %_do_dirs - explain what is meant by "traversed"
    - %_do_files - explain that it means "directory entries processed", i.e., both files and directories
    - mention that the loop control variable is a normal environment variable, any preexisting values overwritten on executing DO, and deleted when the DO is completed, but remains defined if the DO is exited by LEAVE or GOTO.

    Suggested enhancements
    - new internal variable: _do_count
    this variable would be set to 0 when DO is entered, and incremented each time the body of the loop is executed, available as a counter within the DO loop and after it is completed.
     

Share This Page