Page 1 of 1
Getting folders and files from a drive and storing them..
Posted: Fri Jun 04, 2004 9:43 pm
by dagcrack
Hello, I've seen a thread about this b4, but now coudlnt find it and the link I've got, isnt working..
The idea is get each directory and file from a drive..
So I can store them.
Anyone knows?
Posted: Fri Jun 04, 2004 9:57 pm
by fweil
dagcrack,
I guess you mean to parse a whole tree or sub-tree ...
Here is the recursive code I use :
Code: Select all
Global DirectoryLevel.l
Dim Directory.s(100)
Procedure ParseDirectory()
If ExamineDirectory(DirectoryLevel, Directory(DirectoryLevel), "*.*")
Repeat
UseDirectory(DirectoryLevel)
Type = NextDirectoryEntry()
Select Type
Case 0
Case 1
FileName.s = Directory(DirectoryLevel) + DirectoryEntryName()
Debug FileName.s
Case 2
Name.s = DirectoryEntryName()
If Name <> "." And Name <> ".."
Name = Directory(DirectoryLevel) + Name + "\"
DirectoryLevel + 1
Directory(DirectoryLevel) = Name
ParseDirectory()
UseDirectory(DirectoryLevel)
EndIf
EndSelect
Delay(5)
Until Type = 0
EndIf
DirectoryLevel - 1
EndProcedure
;
;
;
DirectoryLevel = 0
Directory(DirectoryLevel) = "C:\InetPub\"
ParseDirectory()
End
It does not list Folders (Case 2 where you can change it).
Posted: Fri Jun 04, 2004 10:43 pm
by dagcrack
fweil, Thanks for your reply and snippet, helps me understand how to achive this.
btw, can I use part of your code for my project? (its a freeware proggy).
Posted: Fri Jun 04, 2004 11:01 pm
by fweil
Does not matter if your code is free or not.
You can use it ...
Just add a banner to the user each time the program will use it !
Or do not add anything but remember I was part of your code ...

Posted: Fri Jun 04, 2004 11:02 pm
by dagcrack
Isnt a credit with your name enought ?
Just your nick or your full name? in the case of the last one, give me your name

Posted: Fri Jun 04, 2004 11:08 pm
by fweil
francois weil /
fweil@internext.fr /
www.francoisweil.com
Choose what you want part of all
Rgrds
Posted: Fri Jun 04, 2004 11:14 pm
by dagcrack
All goes to the credits.

Cya.
Posted: Sat Jun 05, 2004 9:42 am
by blueznl