Classic Object Pascal for free
Does anyone have something that just goes from the current directory down and lists all files. I'm sure I could write it myself, but that means diving into the manuals, and right now I'm a tiny bit lazy...
A basic skeleton nicked from one of my FPC programs looks like this (uses sysutils,classes). VP has sysutils, so I guess that will ok.
The principles for doing old-skool over unit dos are roughly the same afaik, but I haven't used that unit in over ten years.
var Rec : TSearchRec;
Path := IncludeTrailingPathDelimiter(startpath) ; // d6+ but only appends a \ if none is there.
if FindFirst (path+'*', faAnyFile, Rec) = 0 then
if (rec.Attr and faDirectory)>0 then
if (rec.name<>'.') and (rec.name<>'..') then
until FindNext(Rec) <> 0;
FindClose(Rec) ; // not required for TP 8.3 dos, but required for dos with LFN and all other OSes.
// I prefer to first read all files, close handle, and only then recurse. Saves on handles and is more predicatble.
for i:=0 to dirs.Count-1 do