473,508 Members | 2,367 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

First file within a directory

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 know who this can be done?

Thanks...
Jun 7 '07 #1
7 1549
Gaurav wrote:
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 know who this can be done?
You asked the same question a couple of hours ago and
got two replies.

Why not start from there instead of starting a new thread.

Arne
Jun 7 '07 #2

"Arne Vajhøj" <ar**@vajhoej.dkwrote in message
news:46***********************@news.sunsite.dk...
Gaurav wrote:
>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 know who this can be done?

You asked the same question a couple of hours ago and
got two replies.

Why not start from there instead of starting a new thread.
Do you want me to step on the OP for you? I can certainly do that. It would
be a pleasure. :)

Jun 7 '07 #3
Mr. Arnold wrote:
"Arne Vajhøj" <ar**@vajhoej.dkwrote in message
news:46***********************@news.sunsite.dk...
>Gaurav wrote:
>>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 know who this can be done?

You asked the same question a couple of hours ago and
got two replies.

Why not start from there instead of starting a new thread.

Do you want me to step on the OP for you? I can certainly do that. It
would be a pleasure. :)
That would not be necessary.

Arne
Jun 7 '07 #4

"Gaurav" <Ga****@discussions.microsoft.comwrote in message
news:46**********************************@microsof t.com...
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 know who this can be done?
string[] files = Directory.GetFiles(filePath);
Array.Sort(files);

http://samples.gotdotnet.com/quickst.../doc/sort.aspx
http://msdn2.microsoft.com/en-us/lib...rray.sort.aspx

Jun 7 '07 #5

"Arne Vajhøj" <ar**@vajhoej.dkwrote in message
news:46***********************@news.sunsite.dk...
Mr. Arnold wrote:
>"Arne Vajhøj" <ar**@vajhoej.dkwrote in message
news:46***********************@news.sunsite.dk. ..
>>Gaurav wrote:
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 know who this can be done?

You asked the same question a couple of hours ago and
got two replies.

Why not start from there instead of starting a new thread.

Do you want me to step on the OP for you? I can certainly do that. It
would be a pleasure. :)

That would not be necessary.
I am at your calling when needed, just call with a top post. :)

Jun 7 '07 #6
What is meant by "the first file within a directory"? First in what sense?
The one that happens to be the first entry stored in the directory? Why is
that useful? Or do you mean the first after the files are sorted by some
criterion, such as name or age?
Jun 7 '07 #7
On Jun 7, 9:13 am, "Michael A. Covington"
<l...@ai.uga.edu.for.addresswrote:
What is meant by "the first file within a directory"? First in what sense?
The one that happens to be the first entry stored in the directory? Why is
that useful? Or do you mean the first after the files are sorted by some
criterion, such as name or age?
Does the 'First' file mean the first file you can see in windows
explorer. As per default setting files are sorted based on FileName.
Clarify what exactly you want to achieve. If it's filename sort order
you can use Array.Sort method as pointed out by Arnold.

Jun 7 '07 #8

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

Similar topics

16
2867
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...
3
1595
by: bettina | last post by:
How should it be named the first site in a website in PHP? Is there any special rule? index.php for example? I would like to know how it functions that by giving the wed address (www.jfdhjdfh.de...
19
2132
by: DotNetIsHorrible | last post by:
I write CRUD database applications for a living for an audience of about 100 users per application using classic ASP. I maintain and frequently change on user's request 22 different applications...
3
2982
by: comp.lang.php | last post by:
Using Linux/PHP 4.3.2 CLI: $fileID = fopen('myfile.txt', 'r'); // WORKS JUST FINE Using Linux/PHP 4.3.8 CLI: $fileID = fopen('myfile.txt'); // THROWS WARNING 'no such file or directory...
1
14614
by: Eric Wood | last post by:
We have an application that is accessed using shared drives, client executes program from server. We have already coded the program to create and save the a bat file either locally on the users...
29
2608
by: jaysherby | last post by:
I'm new at Python and I need a little advice. Part of the script I'm trying to write needs to be aware of all the files of a certain extension in the script's path and all sub-directories. Can...
5
1562
by: Justin Fancy | last post by:
Hi Everyone, I am developing a file aging program that will eventually report on every folder that is in the root directory. I have a list of requested years, and counters set up to count every...
6
15033
by: lawrence k | last post by:
If I ssh to my server and look at the php.ini file, it apears that open_basedir is off: ; open_basedir, if set, limits all file operations to the defined directory ; and below. This directive...
4
6876
by: Vlad | last post by:
I am having problems using the file.create method within a function that is called when looping through an array of filepaths. If I call my function with a hardcoded file path --C:\Temp.txt the...
0
7120
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
7380
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...
1
7039
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
7494
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4706
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1553
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.