Method 1 :
create a file dir_list
of all directory trees to be processed; then do
for %d in (@dir_list) (pushd %d %+ global ... %+ popd )
Method 2 :
if there are NO hidden directories you want to actually process, use the method of the old EXCEPT command:
- create a file listing the top directory of each not to process
- save the current state of their H attribute:
for /r %d in (@no_tree) if %attrib[@d,H] EQ 1 echo %d >! was_hidden
- HIDE them:
attrib a:-h +H @no_tree
- use GLOBAL without /H option
global /i /q if isfile *.url if %@index[%_cwd,%userprofile\Favorites] lt 0 move /md /r /p *.url %userprofile\Favorites\URLs\
- unhide all that you hid above:
attrib -h @no_tree
- rehide as needed:
if isfile was_hidden attrib +H @was_hidden
BTW, it is possible to create just a list of directories which you had to actually hide, and only unhide those, possibly by the report of the ATTRIB command which hid them, saving a tiny bit of time.
Method 3 :
Create a root-level directory, and populate it with symlinks or junctions to each tree to be actually processed. Now you can use GLOBAL in this directory. This is just an alternate implementation of the underlying principle of Method 1.
Method 4 :
In the original GLOBAL method, check every directory's location against ALL possible excluded paths, instead of just one or two...
Methods1 1 and 3 have difficulty if there is a directory which is to be processed but which has one or more subdirectories that are to be excluded, e.g., C:\users