-------------------------------------------------------------------------------
help for fs
-------------------------------------------------------------------------------

Show names of files in compact form

fs [filespec [filespec [ ... ]]]

Description

fs lists the names of files in compact form. Note that files do not include folders or directories.

With no arguments, fs lists names of files in the current folder or directory. Otherwise, it follows file specifications. A file specification filespec is a filename or (more commonly) a set of filenames indicated by the use of wildcards * or ?. A folder or directory prefix should be given for files outside the current directory.

See help on dir or ls for listing the names of files with more detailed information. Unlike either of those commands, fs may be given more than one file specification. Also unlike either of those commands, fs shows any hidden files.

The list of filenames is returned in r(files), so long as that is not empty.

Remarks

It is recommended that even if you use Windows, you use forward slashes / rather than backward slashes \. Stata will understand and there will then be no clash with other meanings for the backward slash.

Examples

. fs

. fs *.dta

. fs *.ado *.hlp

. fs /ado/plus/f/*.ado

. fs *.gph . foreach f in `r(files)' { . graph use `f' . more . }

Acknowledgements

William Gould kindly told me about the subroutine for display in columns, which is copied from the source code for classutil. Kit Baum was a very helpful tester.

Author

Nicholas J. Cox, Durham University, U.K. n.j.cox@durham.ac.uk

Also see

Manual: [D] dir

Online: help for dir, help for extended macro functions, help for folders (if installed)