⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mf_dir.hlp

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 HLP
字号:
{smcl}
{* 28mar2005}{...}
{cmd:help mata dir()}
{hline}
{* index dir()}{...}
{* index directories}{...}

{title:Title}

{p 4 4 2}
{bf:[M-5] dir() -- File list}


{title:Syntax}

{p 8 8 2}
{it:string colvector}{bind:  }
{cmd:dir(}{it:dirname}{cmd:,}
{it:filetype}{cmd:,}
{it:pattern}{cmd:)}

{p 8 8 2}
{it:string colvector}{bind:  }
{cmd:dir(}{it:dirname}{cmd:,}
{it:filetype}{cmd:,}
{it:pattern}{cmd:,}
{it:prefix}{cmd:)}

{p 4 4 2}
where

	 {it:dirname}:  {it:string scalar} containing directory name

	{it:filetype}:  {it:string scalar} containing {cmd:"files"}, {cmd:"dirs"}, or {cmd:"other"}

	 {it:pattern}:  {it:string scalar} containing match pattern

	  {it:prefix}:  {it:real scalar}   containing 0 or 1


{title:Description}

{p 4 4 2}
{cmd:dir(}{it:dirname}{cmd:,} {it:filetype}{cmd:,} {it:pattern}{cmd:)}
returns a column vector containing the names of the files in {it:dir} 
that match {it:pattern}.

{p 4 4 2}
{cmd:dir(}{it:dirname}{cmd:,} {it:filetype}{cmd:,} {it:pattern}{cmd:,}
{it:prefix}{cmd:)} does the same thing, but allows you to specify whether 
you want a simple list of files ({it:prefix}=0) or a list of file 
names prefixed with {it:dirname} ({it:prefix}!=0).  
{cmd:dir(}{it:dirname}{cmd:,} {it:filetype}{cmd:,} {it:pattern}{cmd:)}
is equivalent to 
{cmd:dir(}{it:dirname}{cmd:,} {it:filetype}{cmd:,} {it:pattern}{cmd:, 0)}.

{p 4 4 2}
{it:pattern} is interpreted by {bf:{help mf_strmatch:[M-5] strmatch()}}.


{title:Remarks}

{p 4 4 2}
Examples:

{p 8 12 2}
{cmd:dir(".", "dirs", "*")}{break}
returns a list of all directories in the current directory.

{p 8 12 2}
{cmd:dir(".", "files", "*")}{break}
returns a list of all regular files in the current directory.

{p 8 12 2}
{cmd:dir(".", "files", "*.hlp")}{break}
returns a list of all {cmd:*.hlp} files 
found in the current directory.


{title:Conformability}

    {cmd:dir(}{it:dirname}{cmd:,} {it:filetype}{cmd:,} {it:pattern}{cmd:,} {it:prefix}{cmd:)}:
	  {it:dirname}:  1 {it:x} 1
	 {it:filetype}:  1 {it:x} 1
	  {it:pattern}:  1 {it:x} 1
	   {it:prefix}:  1 {it:x} 1
	   {it:result}:  {it:k x} 1, {it:k} number of files matching pattern


{title:Diagnostics}

{p 4 4 2}
{cmd:dir(}{it:dirname}{cmd:,} {it:filetype}{cmd:,} {it:pattern}{cmd:,}
{it:prefix}{cmd:)} returns J(0,1,"") if 

{p 8 12 2}
1.  no files matching {it:pattern} are found,

{p 8 12 2}
2.  directory {it:dirname} does not exist, 

{p 8 12 2}
3.  {it:filetype} is misspecified (is not equal to {cmd:"files"},
    {cmd:"dirs"}, or {cmd:"others"}).

{p 4 4 2}
{it:dirname} may be specified with or without the directory separator on 
the end.  

{p 4 4 2}
{it:dirname}=="" is interpreted the same as {it:dirname}=="."; the current 
directory is searched.


{title:Source code}

{p 4 4 2}
Function is built-in.


{title:Also see}

{p 4 13 2}
Manual:  {hi:[M-5] dir()}

{p 4 13 2}
Online:  help for 
{bf:{help m4_io:[M-4] io}}
{p_end}

⌨️ 快捷键说明

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