473,399 Members | 4,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

First file in a directory?

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!
Jun 6 '07 #1
2 4217
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, ...
Jun 7 '07 #2
Gaurav wrote:
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
Jun 7 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: John | last post by:
Hello. If I want to set up my first database and start using it in Dreamweaver what do I need to do? The book I'm working on has a CD with the database on. It is telling me to put it in the...
6
by: bart_nessux | last post by:
Hello, I have some Macbinary files on a PC. I want to recursively read these files and remove the first 128 bytes of the files if they contain the macbinary header info. I know how to read...
5
by: BillZondlo | last post by:
I am new to VsC#. Am working on Visual Studio .NET Pro 2003. I wrote a solution that is a form containing 2 buttons. Button1 uses folderBrowserDialog to select a directory. Button2 uses...
2
by: MSDN | last post by:
Hello, I have the following code below that does not work for me because the directory has millions of files. foreach (string ofile in System.IO.Directory.GetFiles(strMyDir)) { ...
4
by: Craig Vermeer | last post by:
Hi All, I have a program that's using the file system as a queuing mechanism, and it's consuming an inordinate amount of CPU time when the file system queue gets all that large (any more than a...
1
by: ImamicPH | last post by:
Hi, My first post. How do you resolve linker errors? I have a simple header file that contains one function declaration. This function is used in another file (.cpp) in the definition of a...
7
by: =?Utf-8?B?R2F1cmF2?= | last post by:
Hi...I have a requirement to find the first file within a directory. I know we can use the GetFiles() method of Directory class, but am a little stuck up with the syntax. Can somebody plz let me...
0
by: Eric von Horst | last post by:
Hi, we have a third-party product that has a C++ api on HP-UX. I would like be able to use the API in Python (as I remember Python is good at doing this). I have no experience with this so...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.