Category : File Managers
Archive   : DTREE.ZIP
Filename : DT.C

 
Output of file : DT.C contained in archive : DTREE.ZIP
#include "dir.h"
#include "dos.h"

#define DIR_SIZE MAXDIR + MAXDRIVE
#define NUM_DISKS 12

char cur_dir [DIR_SIZE];
char path [DIR_SIZE];
char d [DIR_SIZE];
char top_dir[] = "C:\\";
char *dot = ".";
char *dotdot = "..";
int num_lines = 0;
int current_disk_num;
char current_disk;
char disks [NUM_DISKS] = {'A','B','C','D','E','F','G','I','J','K','L'};

build_tree ()
{
int done,done2;
int status;
long total_size;
struct ffblk ffblk,ffblk2;
char dir [DIR_SIZE];
char pd [DIR_SIZE];
char c;

getcwd (&dir,DIR_SIZE);

if (strcmp(&dir,&top_dir) != 0)
strcat (&dir,"\\");

strcat (&dir,&d);
status = chdir (dir);

total_size = 0;
done2 = findfirst ("*.*",&ffblk2,0);
while (!done2)
{
total_size += ffblk2.ff_fsize;
done2 = findnext (&ffblk2);
}
printf (" (%ld)\n",total_size);

if (num_lines++ >= 22)
{
num_lines = 0;
printf ("\nHit any key to continue...");
c = getch();
if (c == 'X')
{
chdir (cur_dir);
exit(1);
}
printf ("\n");
}

done = findfirst ("*.",&ffblk,FA_DIREC);

while (!done)
{
if ((ffblk.ff_attrib == FA_DIREC) && (strcmp(ffblk.ff_name,dot) != 0) &&
(strcmp(ffblk.ff_name,dotdot) != 0))
{
strcpy (&d,&ffblk.ff_name);
getcwd(&pd,DIR_SIZE);

if (pd[(strlen(&pd)-1)] != '\\')
strcat (&pd,"\\");

strcat (&pd,&d);
printf ("%s",pd);


build_tree();
}
done = findnext (&ffblk);
}
chdir ("..");
}

main ()
{
int status;

getcwd (&cur_dir,DIR_SIZE);

current_disk_num = getdisk();
current_disk = disks [current_disk_num];
top_dir[0] = current_disk;

printf ("All Directories for Drive %c and disk space used in each.\n\n",
current_disk);

printf ("%c:\\",current_disk);

status = chdir ("\\");

strcpy (&d,".");

build_tree ();

chdir (cur_dir);
}

  3 Responses to “Category : File Managers
Archive   : DTREE.ZIP
Filename : DT.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/