25
$\begingroup$

Documentation discrepancy present in 10.3 and fixed in 10.4.1


According to the documentation for FileNames under Details:

FileNames[forms,dirs,{n}] includes names of directories only if they appear exactly at level n.

However when I attempt to use this syntax I get an error:

FileNames["foo*", "c:\\", {2}]

FileNames::innf: Non-negative integer or Infinity expected at position 3 in FileNames[foo*,c:\,{2}]. >>

I am using Mathematica 10.0.1 under Windows. Does this syntax work on other systems?

$\endgroup$
18
  • 1
    $\begingroup$ I have exactly the same error message with both MMA 10.0.1.0 and MMA 9.0.1.0, on OS X 10.9.4 (when I input for example FileNames["foo*", "/", {2}]) Also in MMA 9.0.1.0 Documentation, the curly brackets are missing : !enter image description here $\endgroup$
    – SquareOne
    Commented Sep 24, 2014 at 8:37
  • 18
    $\begingroup$ Maybe they have a documentation driven development at WRI. They first write the doc and then implement the stuff and some guy went home early :-) $\endgroup$
    – halirutan
    Commented Sep 24, 2014 at 8:55
  • 1
    $\begingroup$ @Mr.Wizard It was meant only half as joke. I was referring to test-driven development which is similar only that you write unit tests for components that don't exist yet. Then you hit random keys until you come up with code that fulfills the test.. $\endgroup$
    – halirutan
    Commented Sep 24, 2014 at 14:50
  • 1
    $\begingroup$ @Mr.Wizard So I got a reply that is was already reported. $\endgroup$
    – Kuba
    Commented Mar 5, 2015 at 19:03
  • 3
    $\begingroup$ Persistent in 10.2. $\endgroup$
    – rcollyer
    Commented Jul 15, 2015 at 12:58

1 Answer 1

2
$\begingroup$

It was fixed in 10.4.1

Posting this wiki answer to reduce the unanswered questions stack

FileNames["D*", $InstallationDirectory, {2}]
{"C:\\Program Files\\Wolfram Research\\Mathematica\\10.4\\SystemFiles\\Data", 
 "C:\\Program Files\\Wolfram Research\\Mathematica\\10.4\\SystemFiles\\Devices", 
 "C:\\Program Files\\Wolfram Research\\Mathematica\\10.4\\SystemFiles\\Dictionaries"}
$\endgroup$
2
  • 1
    $\begingroup$ FileNames["foo*", "c:\\", {2}] cannot run normally still. $\endgroup$
    – yode
    Commented Dec 8, 2016 at 14:45
  • $\begingroup$ @yode yes, but it seems it is a different bug now :) $\endgroup$
    – Kuba
    Commented Dec 8, 2016 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.