Issue #16396 has been updated by shevegen (Robert A. Heiler).


I can not say whether this is the case or not (I work only on Linux), also due to me
using Dir[] preferentially instead. With Dir[] I always make sure to have a trailing
'/' token if I wish to work with directories, and subdirectories, respectively, e.g:

    pp Dir['/tmp/**/**/']

Based on that I tend to then use .select or .reject, such as when I wish to find
only certain files. There is also Dir.glob() but I sort of transitioned into Dir[]
completely - it just seems so much simpler to me than all alternatives.

Back to your comment - it may be best to compare the results that you have found
with Find.find(), to Dir[], and look whether there are any alternatives that may
be a bug. If it is a bug, it could help the ruby core team if you could reproduce
it into a small use case that they can test (I think most ruby core team members
use linux or mac, although perhaps some also have windows or some dual-boot setup.)

The easier it can be made for the core team to test, the better if the goal is to
resolve problems (if they are really problems that is).

On a side note - I have found that my ruby code works fine on windows too even if
I just use "/" in file paths. The reason I adopted trailing / a long time ago is
because it made it simpler to me, understanding what is going on. Perhaps your 
description may also be an example where trailing / are bettr to use, as in them
being more explicit - even if there should not be a difference (I really can't 
say, I don't use or seem to need Find.find() really).

----------------------------------------
Misc #16396: What is the reason for this behaviour of Find.find?
https://bugs.ruby-lang.org/issues/16396#change-82970

* Author: stiuna (Juan Gregorio)
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
When I want to travel the paths that are in a disk this happens to me:

``` ruby
#Source folder script: D:\Downloads\Ruby 2.5.3\rbL\comp\codeShort.rb -> In this folder there are few files
Find.find('D:') #Search only in the source folder where the .rb script is located

#Source folder script: D:\Downloads\Ruby 2.5.3\rbL\codeShort.rb -> In this folder there are many files
Find.find('D:') #Search the entire disk D
```

For the first case I have solved it like this:

``` ruby
Find.find('D:/') #Search the entire disk D
```

But I don't understand why in both cases being the same instruction they behave differently just because they are in different directories.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>