First file in a directory?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi... I am trying to get the name of the first file in a directory. I know
that I have to use the Directory class and the GetFiles method. I am a little
stuck with the syntax ... can somebody plzzzz show me a code snippet on how
to "get the first file in a directory".

Appreciate your help!
 
Gaurav a écrit :
Hi... I am trying to get the name of the first file in a directory. I know
that I have to use the Directory class and the GetFiles method. I am a little
stuck with the syntax ... can somebody plzzzz show me a code snippet on how
to "get the first file in a directory".


Hi,
What do you mean by the first file ?

It depends if they are sorted by name, size, date, ...
 
Gaurav said:
Hi... I am trying to get the name of the first file in a directory. I know
that I have to use the Directory class and the GetFiles method. I am a little
stuck with the syntax ... can somebody plzzzz show me a code snippet on how
to "get the first file in a directory".

Directory.GetFiles()[0]

or ??

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top