473,379 Members | 1,174 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,379 software developers and data experts.

how to list out all the folder names in the directory

hi, i'm helping my friend ask..is there a way to list out all the name of the folder in a directory eg. C:\. Thanks.

p.s using vb 2005
May 18 '07 #1
2 1333
shidec
26
use System.IO to process anyting about file & folder

Expand|Select|Wrap|Line Numbers
  1.  
  2.         Dim files() As String
  3.         Dim i As Integer
  4.         files = System.IO.Directory.GetFiles(System.IO.Directory.GetCurrentDirectory)
  5.         For i = 0 To files.Length - 1
  6.             TextBox1.Text = TextBox1.Text + files(i) + vbCrLf
  7.         Next
  8.  
May 18 '07 #2
Plater
7,872 Expert 4TB
Take a look at Directory.GetDirectories()
Expand|Select|Wrap|Line Numbers
  1. string[] directorynames=Directory.GetDirectories(path, searchpatttern, searchoptions);
  2.  
(NOTE: You will have to make that VB code and not C#, but the calls are the same)
May 18 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: mallyonline | last post by:
Thank you for your previous help. I posted regarding listing the names of files held in a folder on the server and making the list appear clickable. This has now been accomplished. The...
3
by: ALI-R | last post by:
how can I get a list of file names in an specific folder? thanks
7
by: =?Utf-8?B?QmlsbA==?= | last post by:
I want to get a list of the files in an FTP folder. I have seen the example of MSDN using the FtpWebRequest, and it's fairly trivial to execute an NLIST command, but the trouble is that this...
3
by: kinnu | last post by:
Hi How to list the names of all the folders in a drive ???? OR I have taken a Dir (directory list box) and text box. And using the timer, the selection of the the directories in the...
3
by: Killer42 | last post by:
Here's a simple VB6 code snippet that uses the FileSystemObject model to find all the files in C:\Temp and load their names into a listbox. To use this sample, you need to set things up as follows: ...
6
by: kimiraikkonen | last post by:
Hello, I have a listbox and folder browser control. I need to display all .mp3 files' pathes into listbox. It was Ok with openfiledialog but how can list all .mp3 extension- having files into...
8
by: 7effrey | last post by:
Hi Does anyone know how to make a script that list the folders in a specific directory, but when the list is made it must be possible to click on it like a link so people can be redirected, but...
2
by: pbrown | last post by:
Hey All, My problem appears to be pretty simple. I need a way of listing all the folders that exist in a certain directory. By all the folders, I mean ALL the folders; any file folder that exists...
5
by: Marge | last post by:
are there any examples of suggested methods to get the same results as the old DriveListBox & DirListBox from VB6. Express uses the openfiledialog but examples would be a great time saver,...
2
by: Mike P | last post by:
I need to find all the folders at a certain location, and then once I have this list of folders I need to add some of them to a collection and then show the names of those folders on screen (there...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.