Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: Lobo on November 06, 2003, 09:40 PM

Title: Dir() Function
Post by: Lobo on November 06, 2003, 09:40 PM
Im useing the directory function to find files with a certain extension. Here's the code im useing so far.


Dim SFindFile as string
SFindFile = Dir(App.Path & "\*.ini")
lstprofile.Additem SFindFile


Now I only get 1 file added to the listbox, but I have more then 1 in the directory. I tryed looping it but I don't think I did the loop right, maybe you can point out something that will help me. If not thanks for looking at it.
Title: Re:Dir() Function
Post by: iago on November 06, 2003, 10:28 PM
http://visualbasicforum.com/showthread.php?t=99464&highlight=fso%2A

QuoteHello,
I have a folder that has *.tif and *.txt files in it...
I want to point to the folder and read the file names. If the file names match my criteria i want to copy them to another folder.
I know how to point to a file within a folder using the commondialog. and read *.txt files but I dont know how to read in the files in a folder. How do I just read the file names in a folder so I can move the ones I that match the criteria?
Can anyone point me to a web page that might help?
Thanks.


The question is answered there.  I hope that helps! :)
Title: Re:Dir() Function
Post by: Spht on November 06, 2003, 10:30 PM
After defining file mask you want to use with Dir, you can then use Dir with no parameters to continuously get the next matching file. After Dir returns nothing, then you've reached the end of the matching files.
Title: Re:Dir() Function
Post by: Lobo on November 06, 2003, 10:37 PM
Thanks Spht, and iago. Also sorry if I toke up any of your time with this question.
Title: Re:Dir() Function
Post by: iago on November 06, 2003, 10:45 PM
Nope, I just did a quick google search for "visual basic dir" (without the quotes)