Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old October 30th, 2003, 03:40 PM
join2003 join2003 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 2 join2003 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question How do I read file names from a directory

Can anyone help me with this?
I need to read a file name using FileSystemObject in a file directory and pass it to a variable one at a time.
Thanks!

Reply With Quote
  #2  
Old October 30th, 2003, 11:09 PM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
I give u a sample that read a special directory and show the filename in this directory on the messagebox..

sub readdir(dirpath as string)
dim fso as new filesystemobject
dim folder
dim files
dim file

set folder=fso.Getfolder(dirpath)
set files=folder.Files

for each file in files
msgbox file.name
next

set file=nothing
set files=nothing
set folder=nothing
set fso=nothing

end sub

Reply With Quote
  #3  
Old October 31st, 2003, 03:58 PM
join2003 join2003 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 2 join2003 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Re:How do I read file names from a directory

Thanks for your help!

Reply With Quote
  #4  
Old November 4th, 2003, 07:03 AM
TwProgrammer TwProgrammer is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 6 TwProgrammer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
theres no such thing called as filesystemobject!
i tryed it but it wouldnt work

Reply With Quote
  #5  
Old November 4th, 2003, 08:34 AM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
TwProgrammer!When u call filesystem object,u should to add the reference of the MS Script Runtime for your project..

Reply With Quote
  #6  
Old November 4th, 2003, 08:46 AM
Unkie Unkie is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 32 Unkie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 28 m 27 sec
Reputation Power: 5
project -> references -> microsoft scripting runtime

that should get you on your way ^^

Reply With Quote
  #7  
Old November 5th, 2003, 06:58 AM
TwProgrammer TwProgrammer is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 6 TwProgrammer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
geez thanks alot!

Reply With Quote
  #8  
Old November 5th, 2003, 07:21 AM
TwProgrammer TwProgrammer is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 6 TwProgrammer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
the files worked fine, but how do i also get folders?

Reply With Quote
  #9  
Old November 5th, 2003, 06:17 PM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
sub getdir(dirpath as string)
dim fso as new filesystemobject
dim folder
dim subfolders
dim subfolder

set folder=fso.Getfolder(dirpath)
set subfolders=folder.subfoldes

for each subfolder in subfolders
msgbox subfolder.name
next

set subfolder=nothing
set subfolders=nothing
set folder=nothing
set fso=nothing

end sub

If u will learn more kownledge,plz visit http://msdn.microsoft.com/library/d...ystemobject.asp

Last edited by cleverpig : November 5th, 2003 at 06:26 PM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > How do I read file names from a directory


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway