help for fsx

Show names of files in compact form (Unix-friendly defaults)

fsx [filespec [filespec [ ... ]], all ]


fsx is a fork of fs. Both commands list the names of files in compact form. Note that files do not include folders or directories. The change in the fsx fork is that it suppresses hidden Unix files by default (much like the Stata command ls or the Unix command of the same name). These files are revealed with the all option, similar to the "ls -a" syntax in Unix.

With no arguments, fsx lists names of files in the current folder or directory but excludes hidden files. 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, fsx may be given more than one file specification. Like dir or ls, but unlike the original fs command, fsx suppresses hidden files.

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


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.

This command has been successfully tested on Windows but is most relevant for Unix (i.e., Mac, Linux, Solaris) as these operating systems use hidden files marked by leading dots which most Unix users will prefer to leave alone.

Options all allows a query to return hidden files, which are otherwise suppressed. When this option is used, fsx behaves exactly like fs.


. fsx

. fsx, all

. fsx *.dta

. fsx *.ado *.hlp

. fsx /ado/plus/f/*.ado

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

Saved results

r(files) files matching the query


This command was forked from the original fs by Nick Cox. Please direct all support questions specifically about fsx to Rossman.


Gabriel Rossman, UCLA, USA. rossman@soc.ucla.edu

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), help for fs (if installed)