473,326 Members | 2,111 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,326 software developers and data experts.

list of files in an specific folder

how can I get a list of file names in an specific folder?

thanks
Nov 16 '05 #1
3 10967
Private Function FileList(ByVal Dirpath As String) As String

Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder

For Each f As String In Directory.GetFiles(Dirpath)

sb.Append(String.Format("{0}{1}", f, Environment.NewLine))

Next

Return sb.ToString

End Function
public

"ALI-R" <al*@microsoft.com> wrote in message
news:uo**************@tk2msftngp13.phx.gbl...
how can I get a list of file names in an specific folder?

thanks

Nov 16 '05 #2
This is the C# newsgroup!

using System.IO;
....
public void test(string strPath)
{
if (Directory.Exists(strPath))
{
foreach (string s in Directory.GetFiles(strPath))
{
MessageBox.Show(s);
}
}
}

Look at the Directory class in the online help to learn more.

ShaneB

"Jim Hughes" <NO*********@Hotmail.com> wrote in message
news:O5**************@TK2MSFTNGP09.phx.gbl...
Private Function FileList(ByVal Dirpath As String) As String

Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder

For Each f As String In Directory.GetFiles(Dirpath)

sb.Append(String.Format("{0}{1}", f, Environment.NewLine))

Next

Return sb.ToString

End Function
public

"ALI-R" <al*@microsoft.com> wrote in message
news:uo**************@tk2msftngp13.phx.gbl...
how can I get a list of file names in an specific folder?

thanks


Nov 16 '05 #3
mea culpa

I'm bi, (By that, I mean I read and reply in both groups :) )

It was such a "BASIC" question, I instinctively replied with a BASIC answer.

"ShaneB" <st********@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
This is the C# newsgroup!

using System.IO;
...
public void test(string strPath)
{
if (Directory.Exists(strPath))
{
foreach (string s in Directory.GetFiles(strPath))
{
MessageBox.Show(s);
}
}
}

Look at the Directory class in the online help to learn more.

ShaneB

"Jim Hughes" <NO*********@Hotmail.com> wrote in message
news:O5**************@TK2MSFTNGP09.phx.gbl...
Private Function FileList(ByVal Dirpath As String) As String

Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder

For Each f As String In Directory.GetFiles(Dirpath)

sb.Append(String.Format("{0}{1}", f, Environment.NewLine))

Next

Return sb.ToString

End Function
public

"ALI-R" <al*@microsoft.com> wrote in message
news:uo**************@tk2msftngp13.phx.gbl...
how can I get a list of file names in an specific folder?

thanks



Nov 16 '05 #4

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

Similar topics

1
by: nafogel | last post by:
Hi, I am kinda familiar with html, but i am having a problem. I am working on a menu system for a handheld gaming device (PSP). I want the menu to be able to display all files with a certain...
1
by: mmohanra | last post by:
I am trying to list files in a folder in a remote server. I am using Scripting.FileSystemObject. This seems to be really slow. After a long time the connection times out. Is there any other way to...
2
jaccess
by: jaccess | last post by:
I was wondering if there is a simple way to open a specific folder from an access form button. I have a form that a user can enter a date range and either view or print reports based on the date...
5
by: Alice | last post by:
I'm trying to upload all .txt files from a specific folder using the following code, but it didn't work. HELP The problem lies in DoCmd.TransferText acImportFixed, "Imperial Import...
0
by: raviranjan249 | last post by:
How to search for a particular string in a specific folder in all files throgh asp. If you have solution then pm to me <email removed>
5
by: akmsikhan | last post by:
I am using a Toshiba Satellite M115 Series Laptop. Recently I was trying to see some hidden files but I can't. When I try to enable Show Hidden Files and Folder it is not enabling. Each time I click...
1
by: mpetter | last post by:
Hi guys ! How Can I Create a contact item(Outlook 2003) in specific folder under default folder? I have this situation: Set myolApp = CreateObject("Outlook.Application") Set myNameSpace =...
3
by: froditus | last post by:
Hello everyone, is it possible to list files from directory other than in apache web directory? my web folder is placed on c:/ and i put my files in windows directory "d:/files/images/". I...
3
by: Ned White | last post by:
Hi All, I would like to create a httphandler to set text watermark on image files before it gets displayed to the user. But this handler must listen specific folder or virtual directory(on same...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.