trailing slash issue in Find.find

Discussion in 'Ruby' started by Jeff Mitchell, Aug 24, 2003.

  1. require "find"
    Find.find("/usr/bin/") { |file| puts file }

    [...]
    /usr/bin//rmdir
    /usr/bin//rm
    /usr/bin//mv
    /usr/bin//mknod
    /usr/bin//mkfifo
    /usr/bin//mkdir
    /usr/bin//ls
    /usr/bin//ln
    /usr/bin//install
    /usr/bin//du
    /usr/bin//dircolors
    /usr/bin//dir
    /usr/bin//df
    /usr/bin//dd
    /usr/bin//cp
    [...]

    I ran into this while doing string compares between filenames obtained
    from File.find and filenames obtained elsewhere. Needless to say they
    didn't compare very well :)

    FWIW, GNU's find, BSD's find, and perl's find all produce the same output
    for "/usr/bin" and "/usr/bin/".

    -Jeff
     
    Jeff Mitchell, Aug 24, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    318
    Max Erickson
    Nov 10, 2006
  2. abcd
    Replies:
    7
    Views:
    346
    Ben Finney
    Mar 15, 2007
  3. Harlan Messinger

    ASP.NET inserts trailing slash in tag

    Harlan Messinger, Feb 18, 2008, in forum: ASP .Net
    Replies:
    4
    Views:
    475
    Harlan Messinger
    Feb 19, 2008
  4. Stan Brown
    Replies:
    6
    Views:
    398
    Stan Brown
    Oct 29, 2003
  5. Sebastian Bauer

    HTTP::Request, trailing slash

    Sebastian Bauer, Jun 29, 2004, in forum: Perl Misc
    Replies:
    9
    Views:
    185
    Sebastian Bauer
    Jul 1, 2004
Loading...

Share This Page