From: Charles Hixson Date: 2001-09-27T00:27:22+09:00 Subject: [ruby-talk:21731] Re: Problem with directory? Re: Path walkin g on windows This is a multi-part message in MIME format. --------------090603050402090206090908 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Hi Barry, I'm not sure quite what you mean by characterise, so here's an attempt: Volume in drive C has no label Volume Serial Number is 261E-15ED Directory of C:\Docs\TIP_HTML .. 04-19-2001 7:55a . ... 04-19-2001 7:55a .. DOCPROC 09-17-2001 8:39a DocProc DOCS 09-25-2001 2:04p docs HTML 1 05-02-2001 2:42p HTML.1 HTML 04-30-2001 9:43a Html INCOMING 04-30-2001 7:21a incoming PRIORV~1 06-25-2001 2:44p PriorVersn SEVERSN 06-28-2001 2:35p seVersn ATIPFI~1 TXT 623,272 09-06-2001 1:15p aTipFinan.txt ATIPHEAD TXT 260,304 09-06-2001 1:15p aTipHead.txt ATIPHE~1 TXT 6,552 09-06-2001 1:15p aTipHeadB.txt ATIPHE~2 TXT 403,767 09-06-2001 1:15p aTipHeadA.txt BACKUP~2 TXT 215 05-02-2001 3:32p Backup-tipExportSpecs.txt DATE_T~1 E 795 09-12-2001 10:46a date_time.e GLOB E 1,112 09-12-2001 10:01a glob.e LOGGER E 1,964 09-13-2001 8:40a logger.e RUN_LOG TXT 2,865 09-25-2001 2:08p run_log.txt SARRAY E 5,635 09-13-2001 8:42a sarray.e Press any key to continue . . . $ ls /cygdrive/c/docs/tip_html Backup-tipExportSpecs.txt docs tip_db_build.e tip_html1.c DocProc glob.e tip_finan_line.e tip_html1.obj HTML.1 incoming tip_finan_rcrd.e tip_html2.c Html logger.e tip_finan_reader.e tip_html2.obj PriorVersn run_log.txt tip_html.bak tip_html3.c aTipFinan.txt sarray.e tip_html.bat tip_html3.obj aTipHead.txt sarray_cursor.e tip_html.e tip_reader.e aTipHeadA.txt seVersn tip_html.exe utils.e aTipHeadB.txt tip.e tip_html.h date_time.e tip_code.e tip_html.id `ls -l` is attached as a text file. What other information would you want? SHULTZ,BARRY (HP-Israel,ex1) wrote: > I'm running the same Ruby, under Win95 4.00.950r-7 and I'm not getting > any "false negatives" using FileTest.directory? . Can you characterize > the problem directories in some way? > > Barry > >>It runs without detecting an error, but it misidentifies actual >>directories as normal files. >>(Again, this is on a Win95 4.00.950 B system.) >>$ ruby -v >>ruby 1.6.3 (2001-03-19) [i386-cygwin] >> >>(Though it doesn't matter whether I run ruby under dos or >>cygwin, or even directly from RubyWin .. the exact same result >>obtains.) >> >> >>>Date: Sun, 23 Sep 2001 15:31:02 +0900 >>>From: "SHULTZ,BARRY (HP-Israel,ex1)" >>>To: ruby-talk@ruby-lang.org (ruby-talk ML) >>> >>> >>>Hi Charles, >>> >>> It works for me if I change >>> >>>if test("d?", x) >>> >>>to >>> >>>if FileTest.directory?(x) >>> >>>HTH, >>>Barry >>> >>> >>> >>>>-----Original Message----- >>>>From: Charles Hixson [mailto:charlesh@pop.newsguy.com] >>>>Sent: Sunday, September 23, 2001 5:43 AM >>>>To: ruby-talk@ruby-lang.org >>>>Subject: [ruby-talk:21578] Re: Problem with directory? Re: >>>>Path walking >>>>on windows >>>> >>>> >>>>class Dir >>>>def walk (prefix = nil, &walker) >>>>e = self.entries >>>>e.delete "."; e.delete ".." >>>>if prefix >>>>e.collect! {|x| File.join(prefix, x) } >>>>end >>>> >>>>if block_given? >>>>e.each {|x| >>>>print "Processing <<#{x}>> " >>>># afile = File.lstat(x) >>>># puts afile.inspect >>>># f = File.ftype(afile) >>>># puts f.inspect >>>># if f.directory? then >>>># if f == "directory" then >>>>if test("d?", x) >>>>Dir.new(x).walk x, &walker >>>>else >>>>puts "#{x} is not a directory." >>>>end >>>>yield x >>>>} >>>>end >>>> >>>>nil >>>>end >>>>end >>>> >>> >> >>-- >>Charles Hixson >> >>Copy software legally, the GNU way! >>Use GNU software, and legally make and share copies of software. >>See http://www.gnu.org >> http://www.redhat.com >> http://www.linux-mandrake.com >> http://www.calderasystems.com/ >> http://www.linuxapps.com/ >> >> > > --------------090603050402090206090908 Content-Type: text/plain; name="out.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="out.txt" total 1931 -rw-r--r-- 1 chixso 544 215 May 2 15:32 Backup-tipExportSpecs.txt drwxr-xr-x 2 chixso 544 0 Sep 17 08:39 DocProc drwxr-xr-x 2 chixso 544 0 May 2 14:42 HTML.1 drwxr-xr-x 2 chixso 544 0 Apr 30 09:43 Html drwxr-xr-x 2 chixso 544 0 Jun 25 14:44 PriorVersn -rw-r--r-- 1 chixso 544 623272 Sep 6 13:15 aTipFinan.txt -rw-r--r-- 1 chixso 544 260304 Sep 6 13:15 aTipHead.txt -rw-r--r-- 1 chixso 544 403767 Sep 6 13:15 aTipHeadA.txt -rw-r--r-- 1 chixso 544 6552 Sep 6 13:15 aTipHeadB.txt -rw-r--r-- 1 chixso 544 795 Sep 12 10:46 date_time.e drwxr-xr-x 2 chixso 544 0 Sep 25 14:04 docs -rw-r--r-- 1 chixso 544 1112 Sep 12 10:01 glob.e drwxr-xr-x 2 chixso 544 0 Apr 30 07:21 incoming -rw-r--r-- 1 chixso 544 1964 Sep 13 08:40 logger.e -rw-r--r-- 1 chixso 544 2865 Sep 25 14:08 run_log.txt -rw-r--r-- 1 chixso 544 5635 Sep 13 08:42 sarray.e -rw-r--r-- 1 chixso 544 1360 Sep 12 11:26 sarray_cursor.e drwxr-xr-x 3 chixso 544 0 Jun 28 14:35 seVersn -rw-r--r-- 1 chixso 544 13527 Sep 13 10:41 tip.e -rw-r--r-- 1 chixso 544 9093 Sep 13 08:14 tip_code.e -rw-r--r-- 1 chixso 544 5979 Sep 12 13:39 tip_db_build.e -rw-r--r-- 1 chixso 544 7828 Sep 13 08:57 tip_finan_line.e -rw-r--r-- 1 chixso 544 2449 Sep 12 13:52 tip_finan_rcrd.e -rw-r--r-- 1 chixso 544 1602 Sep 12 13:46 tip_finan_reader.e -rw-r--r-- 1 chixso 544 855 Sep 25 14:07 tip_html.bak -rwxr-xr-x 1 chixso 544 855 Sep 25 14:14 tip_html.bat -rw-r--r-- 1 chixso 544 3670 Sep 13 12:20 tip_html.e -rwxr-xr-x 1 chixso 544 76832 Sep 25 14:07 tip_html.exe -rw-r--r-- 1 chixso 544 44057 Sep 25 14:07 tip_html.h -rw-r--r-- 1 chixso 544 12368 Sep 25 14:07 tip_html.id -rw-r--r-- 1 chixso 544 131899 Sep 25 14:07 tip_html1.c -rw-r--r-- 1 chixso 544 57012 Sep 25 14:07 tip_html1.obj -rw-r--r-- 1 chixso 544 144849 Sep 25 14:07 tip_html2.c -rw-r--r-- 1 chixso 544 100068 Sep 25 14:07 tip_html2.obj -rw-r--r-- 1 chixso 544 22816 Sep 25 14:07 tip_html3.c -rw-r--r-- 1 chixso 544 15586 Sep 25 14:07 tip_html3.obj -rw-r--r-- 1 chixso 544 1447 Sep 12 10:04 tip_reader.e -rw-r--r-- 1 chixso 544 378 Sep 13 09:00 utils.e --------------090603050402090206090908--