On 25-Jan-2009, Daniel J Sebald wrote:
| The dir() and ls() routines return strings for file names in a directory, but
they place breaks in file names with spaces, which ostensibly makes the
routines not useful for programming. [I'm not a fan of spaces in file names...
one of the most confusing and messy conventions in computer programming.]
|
| For example, try
|
| mkdir('dir with spaces and # @ $ % [ ]')
| dir('./')
| ls -1
| d = ls -1
|
| Note a couple things. The list returned by dir and ls have line
| breaks, so there is no way to know exactly where line breaks and
| spaces are in files. There is no robust way of using dir and ls
| that I see.
If you write
x = dir ('./')
then you will get a structure array. One of the fields is "name", and
I don't see a problem with spaces if you use this form.