Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

DO varname IN fileset sometimes includes complete filepath in result

May
62
1
Sometimes, when I use a DO varname IN filesetcommand, the output list of files includes the full filepath; sometimes not. This makes it awkward (but not really too hard) to handle the output in a consistent and clean manner. The filepath-prepending seems to be triggered by the use of regular expressions for the fileset. For example:
Code:
@ echo off
  echo do file in /d"D:\TMP\"  /s a*a
  do file in /d"D:\TMP\"  /s a*a
    echo   file is %file     _cwd is %_cwd
  enddo

  echo.
  echo do file in /d"D:\TMP\"  /s "::^a.*a$"
  do file in /d"D:\TMP\"  /s "::^a.*a$"
    echo   file is %file     _cwd is %_cwd
  enddo
Code:
[04:59:51 D:\] test_do
do file in /d"D:\TMP\"  /s a*a
  file is aportala     _cwd is D:\TMP
  file is atunea     _cwd is D:\TMP
  file is aportala     _cwd is D:\TMP\foo
  file is atunea     _cwd is D:\TMP\foo

do file in /d"D:\TMP\"  /s "::^a.*a$"
  file is D:\TMP\aportala     _cwd is D:\TMP
  file is D:\TMP\atunea     _cwd is D:\TMP
  file is D:\TMP\foo\aportala     _cwd is D:\TMP\foo
  file is D:\TMP\foo\atunea     _cwd is D:\TMP\foo

As designed? If so, why?

Bret Sutton
 
Apparently (and contrary to "Wildcards and Regular Expressions in TCC") regular expressions MUST be quoted. It doesn't look like REs were used in the second example below.

Code:
v:\> do f in /d"." "::w3.*\.log" (echo %f)
V:\w32tm.log

v:\> do f in /d"." ::w3.*\.log (echo %f)

v:\>
 
In light of what Rex said. if REs are used below, I'd expect a full path. If REs are not used I'd expect it to find no files.

Code:
v:\> do f in ::w3.*log (echo %f)
w32tm.log
 

Similar threads

Back
Top