Recognizing the Direcory from the File in Dolphin 2.1

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Recognizing the Direcory from the File in Dolphin 2.1

never-mind
Hi,
I solve simple problem. I try to read the content of a directory (for
ex. c:\) recursively and I need to distinguish the directories from
the files.
I use #find: method in File class to read the content of a particular
directory. It answers a collection of WIN32_FIND_DATA structs for each
file matching the wildcarded path string. I didn't find any method for
distinguishing if a member of the collection is a directory or a file.
I used method #splitFilenameFrom: but it does not work properly.

Could anybody give me an advise how solve this problem in dolphin 2.1
?

Thanks ...

-Z-


Reply | Threaded
Open this post in threaded view
|

Re: Recognizing the Direcory from the File in Dolphin 2.1

Ian Bartholomew-18
never-mind wrote:
> I solve simple problem. I try to read the content of a directory (for
> ex. c:\) recursively and I need to distinguish the directories from
> the files.
[]
> Could anybody give me an advise how solve this problem in dolphin 2.1

Directories are indicated by a bit set in the file attributes.  The
following only displays directory names -

File for: 'c:\*.*' do: [:each |
    (each dwFileAttributes allMask: 16)
        ifTrue: [
            Transcript print: each fileName; cr]]

You might get more matches than you expect - some system folders along with
"." and ".." also have this bit set.

--
Ian Bartholomew


Reply | Threaded
Open this post in threaded view
|

Re: Recognizing the Direcory from the File in Dolphin 2.1

never-mind
"Ian Bartholomew" <[hidden email]> wrote in message news:<gR5N9.2931$h43.419092@stones>...

> never-mind wrote:
> > I solve simple problem. I try to read the content of a directory (for
> > ex. c:\) recursively and I need to distinguish the directories from
> > the files.
>  []
> > Could anybody give me an advise how solve this problem in dolphin 2.1
>
> Directories are indicated by a bit set in the file attributes.  The
> following only displays directory names -
>
> File for: 'c:\*.*' do: [:each |
>     (each dwFileAttributes allMask: 16)
>         ifTrue: [
>             Transcript print: each fileName; cr]]
>
> You might get more matches than you expect - some system folders along with
> "." and ".." also have this bit set.

Thank you for your answer.
-Z-