findfile.ado

来自「是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到」· ADO 代码 · 共 56 行

ADO
56
字号
*! version 1.0.5  14jul2003
program findfile, rclass
	version 8
	gettoken fn 0 : 0, parse(" ,")
	syntax [, ALL noDEScend PATH(string)]
	if `"`path'"'=="" {
		local path `"`c(adopath)'"'
	}

	local n 0
	local ltr = substr(`"`fn'"',1,1)
	if `"`ltr'"' != "" {
		gettoken d path : path, parse(";")
		while `"`d'"'!="" {
			if `"`d'"' != ";" {
				local d : sysdir `"`d'"'
				local ffn `"`d'`fn'"'
				capture confirm file `"`ffn'"'
				if _rc==0 {
					di as txt `"`ffn'"'
					if "`all'"=="" {
						ret local fn `"`ffn'"'
						exit
					}
					if `n' {
						ret local fn `"`return(fn)' "`ffn'""'
					}
					else	ret local fn `""`ffn'""'
					local n 1
				}
				if "`descend'"=="" {
					local ffn `"`d'`ltr'`c(dirsep)'`fn'"'
					capture confirm file `"`ffn'"'
					if _rc==0 {
						di as txt `"`ffn'"'
						if "`all'"=="" {
							ret local fn `"`ffn'"'
							exit
						}
						if `n' {
							ret local fn `"`return(fn)' "`ffn'""'
						}
						else	ret local fn `"`ffn'"'
						local n 1
					}
				}
			}
			gettoken d path : path, parse(" ;")
		}
	}
	if "`all'"=="" | `n'==0 {
		di as err `"file "`fn'" not found"'
		exit 601
	}
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?