The opendir procedure opens a directory variable (i.e. associates the directory variable with a directory). NOTE: Directories are also called folders.
//Below is a simple program that lists all the files in the
//current directory.
program listfiles(output);
var
d : dir;
filename : string;
begin
opendir(d, '.'); // Open current directory
repeat
readdir(d, filename); // Get next file in directory
if filename <> '' then
writeln(filename);
until filename = '';
closedir(d) // Close directory
end.
Operating Systems: All
Standard Pascal: No