24
$\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$
  • 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 Sep 24 '14 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 Sep 24 '14 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 Sep 24 '14 at 14:50
  • 1
    $\begingroup$ @Mr.Wizard So I got a reply that is was already reported. $\endgroup$ – Kuba Mar 5 '15 at 19:03
  • 3
    $\begingroup$ Persistent in 10.2. $\endgroup$ – rcollyer Jul 15 '15 at 12:58
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$
  • 1
    $\begingroup$ FileNames["foo*", "c:\\", {2}] cannot run normally still. $\endgroup$ – yode Dec 8 '16 at 14:45
  • $\begingroup$ @yode yes, but it seems it is a different bug now :) $\endgroup$ – Kuba Dec 8 '16 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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