Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!news2.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe21.iad.POSTED!7564ea0f!not-for-mail
From: Walter Roberson <roberson@hushmail.com>
User-Agent: Thunderbird 2.0.0.24 (Macintosh/20100228)
MIME-Version: 1.0
Newsgroups: comp.soft-sys.matlab
Subject: Re: Matlab 2010a dir cmd
References: <hsf7bc$f7m$1@fred.mathworks.com> <hsfab3$rfk$1@fred.mathworks.com> <RnGGn.6843$wV2.3222@newsfe23.iad> <hsfc8r$1lb$1@fred.mathworks.com> <hsfcqc$688$1@fred.mathworks.com>
In-Reply-To: <hsfcqc$688$1@fred.mathworks.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 84
Message-ID: <mPHGn.6332$HG1.3135@newsfe21.iad>
NNTP-Posting-Host: 24.79.143.47
X-Complaints-To: internet.abuse@sjrb.ca
X-Trace: newsfe21.iad 1273710930 24.79.143.47 (Thu, 13 May 2010 00:35:30 UTC)
NNTP-Posting-Date: Thu, 13 May 2010 00:35:30 UTC
Date: Wed, 12 May 2010 19:35:29 -0500
Xref: news.mathworks.com comp.soft-sys.matlab:635282

James wrote:
> Yes, you received two quick replies from two people who obviously had no 
> idea what they were talking about...

~ 500> matlab7_ng -nodisplay -nojvm

                             < M A T L A B (R) >
                   Copyright 1984-2008 The MathWorks, Inc.
                          Version 7.7.0.471 (R2008b)
                              September 17, 2008

Warning: X does not support locale en_CA.UTF-8

   To get started, type one of these: helpwin, helpdesk, or demo.
   For product information, visit www.mathworks.com.

 >> dir('*.')

.   ..

 >> !touch foobar.
 >> dir('*.')

.        ..       foobar.


Does that disagree in any way with my statement that,

"It wouldn't be the behavior I would expect on Unix systems, where the 
trailing period would be treated as a literal, and only names ending in 
period would be returned."

Or did I "not know what" I was "talking about" when I stated that "Derik 
was including a period in the name." ? And was the remainder of my 
article not in the form of a question?

 >  or did not attempt to verify your
 > problem before writing to this thread.

If you provide a Windows PC and Matlab license valid for the appropriate 
releases, then I would be happy to test the boundaries of the Windows 
behaviour.

> I recently installed Matlab 2010 and have run into this issue as well.  
> Very frustrating... many legacy scripts no longer work properly as a 
> result of this flaw.  I, too, would be very interested to hear if there 
> is a workaround of any sort available...

I do not see the referenced dir behaviour documented by Mathworks. What 
Mathworks does say, 
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/dir.html
is that,

"DOS File Names

The MATLAB dir function is consistent with the Microsoft Windows 
operating system dir command in that both support short file names 
generated by DOS."

In DOS, the file names for a directory include a .DIR extension, and the 
names at the Windows level are shown with the .DIR extension striped 
off, including the trailing period. There is thus no documented reason 
to expect that a trailing period is a short cut for indicating 
directories to the dir() command.

I am not doubting that it "happened to work" in the past, but if it did 
then it relied upon undocumented Matlab behaviour.

Is the use of trailing period correct for Windows? Microsoft says not:
http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx

 >>> Do not end a file or directory name with a space or a period.
 >>> Although the underlying file system may support such names, the
 >>> Windows shell and user interface does not. However, it is acceptable
 >>> to specify a period as the first character of a name. For example,
 >>> ".temp"


I would not say that there is a workaround -- but there is obvious 
coding that is portable, operating-system independent, and fully 
documented, and thus is _correct_ coding for the situation:

names = dir('*');
names = names([names.isdir]);