Board index » delphi » Getting the contents of a folder?

Getting the contents of a folder?

Hi all,

I like to have Drag&Drop accept folders, now that
isn't a problem, but it only give me the name of the folder dropped, i would
like to read out the content of the folder that was dropped on the form.

Anyone willing to help or advise me on this subject?

Regards, Samu?l van Laere
the Netherlands
www.fortron.net

 

Re:Getting the contents of a folder?


On Wed, 27 Nov 2002 18:09:57 GMT, "Samu?l van Laere"
<fort...@chello.nl> waffled on about something:

Quote
>Hi all,

>I like to have Drag&Drop accept folders, now that
>isn't a problem, but it only give me the name of the folder dropped, i would
>like to read out the content of the folder that was dropped on the form.

>Anyone willing to help or advise me on this subject?

You only get the filename of the immediate object being dropped.

If someone grabs 2 files and a folder and drops them, you're going to
get 2 filenames and a foldername.

You'll need to detect the 3rd droppee as a folder, then iterate your
way through it and it's sub folders using findfirst/findnext/findclose
until you've got them all.

There are some good examples of findfirst/next on
http://www.efg2.com/Lab/Library/Delphi/IO/Directories.htm#Find

although you'll have to build the iteration of subfolders bit
yourself... hint: don't forget you can get a routine to call itself..
;-)

Dodgy.

Re:Getting the contents of a folder?


Quote
"Dodgy" <Do...@earth.planet.universe> wrote:
> You only get the filename of the immediate object being dropped.

> If someone grabs 2 files and a folder and drops them, you're going to
> get 2 filenames and a foldername.

> You'll need to detect the 3rd droppee as a folder, then iterate your
> way through it and it's sub folders using findfirst/findnext/findclose
> until you've got them all.

> There are some good examples of findfirst/next on
> http://www.efg2.com/Lab/Library/Delphi/IO/Directories.htm#Find

> although you'll have to build the iteration of subfolders bit
> yourself... hint: don't forget you can get a routine to call itself..
> ;-)

> Dodgy.

Thanks for your help Dodgy, it clears a couple of things for me.
Any toughts on how to detect if a folder or a file was dropped on the form?

Regards, Samu?l van Laere
the Netherlands

Re:Getting the contents of a folder?


Ignore my last question, it was easy to solve this.

Regards, Samu?l van Laere

Other Threads