|
功能上类似c大的文件选择模块 http://chenall.net/post/g4d_filelist/
不过检索方式不同 我的以根目录下文件优先输出 具体差别看输出结果截图吧
我的脚本
c大的脚本
!BAT
::call %~0 %dir_deep% %dir_root%
set dir_deep=2 && call Fn.15 "%~1" "" && set dir_deep=%~1
set dir_root=%@root% && call Fn.15 "%~2" "" && set dir_root=%~2
setlocal
debug 0
call :subdir %dir_root%
endlocal
exit
:subdir
if "%~1"=="" && exit
rootnoverify %~d1
set path=%~pnx1
call :pathcheck
call Fn.11 "%bd%" "pd" && set ls=cat %path%DIR.TXT ! set ls=ls %path%
%ls% | call :automake %~1
::echo -e \x01 %@root%%%path% end
set /a dir_deep=%dir_deep%-1
if %dir_deep%>=1 && %ls% | call :subdir_folder %~1
shift
goto :subdir
:subdir_folder
shift
if "%~1"=="" && exit
cat --length=0 %path%%%~1 > nul && goto :subdir_folder
setlocal
call :subdir %@root%%%path%%%~1/
endlocal
goto :subdir_folder
:automake
shift
if "%~1"=="" && exit
cat --length=0 %@root%%%path%%%~1 > nul && echo %@root%%%path%%%~1
goto :automake
::对path值进行检测,以确定是否合法,调用方式 call :pathcheck ;处理结束后path值为“认为”合法的结果
:pathcheck
::检测第一位是否为/
call Fn.15 "%path%" "" || set path=/ ! call Fn.15 "%path:~,1%" "/" && set path=%path:~1% && goto :pathcheck
::若path值最后一位是/,先去掉
call Fn.11 "%path:~-1%" "/" && set path=%path:~,-1%
::重新补齐/
call Fn.15 "%path%" "" && set path=%path%/ ! set path=/
exit
|
|