Mathematica 9 is now available
 Documentation / Mathematica / Built-in Functions / System Interface / File System  /
FileNames

  • FileNames[ ] lists all files in the current working directory.
  • FileNames[" form "] lists all files in the current working directory whose names match the string pattern form.
  • FileNames[ " ", " ", ... ] lists all files whose names match any of the .
  • FileNames[ forms , " ", " ", ... ] lists files with names matching forms in any of the directories .
  • FileNames[ forms , dirs , n ] includes files that are in subdirectories up to n levels down.
  • The string pattern " form " can contain the metacharacters specified in Section A.3.13.
  • FileNames["*"] is equivalent to FileNames[ ].
  • FileNames[ forms , dirs , Infinity] looks for files in all subdirectories of the dirs.
  • The list of files returned by FileNames is sorted in the order generated by the function Sort.
  • FileNames[ forms , dirs , n ] includes names of directories only if they appear exactly at level n.
  • The forms must be names of files only, not including any directory information. Thus, for example, FileNames["../*"] will not work. Instead FileNames["*", ".."] is the appropriate form.
  • Setting the option IgnoreCase -> True makes FileNames treat lower- and upper-case letters in file names as equivalent.
  • On operating systems such as MS-DOS, FileNames always treats lower- and upper-case letters in file names as equivalent.
  • See the Mathematica book: Section 1.11.2Section 2.11.4.
  • See also: Directory, FileType.
  • Related package: Utilities`Package`.


    Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
    THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
    SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.