TreeInfo Info

Posted by Trekman1 on Thu 27 Feb 2003 10:27 PM — 2 posts, 13,278 views.

#0
Hello all. I want to set comma separators in the tree info output after certain points so I can load the txt file to an excel spreadsheet and have the information split into different cells (in excel I use a comma deliminator) Ideally, I would like the txt. file output to have commas in the following spots:

123.764 Mb, 23 files, C:\pdrives\Gammon
654.345 Mb, 53 files, C:\gdrives\beer

…and so on. This will create 3 cells in excell. How do I modify the source code to include commas at these points…or rather where in the code do I add them. I'm not a big programmer so examples from the actual code will be extremely helpful.
This is a great utility!!
Australia Forum Administrator #1
I would change these lines:



      if (level == 0)
        {
        mb = (double) nSize.QuadPart / 1024.0 / 1024.0;
        printf ("%9.3f Mb               %s\\%s \n", mb, thisdir, fileinfo.cFileName);
        }


I would add commas or tabs. Tabs might be better because you might have commas in the file names. They will still work with Excel. Tabs are \t so do this:



      if (level == 0)
        {
        mb = (double) nSize.QuadPart / 1024.0 / 1024.0;
        printf ("%9.3f\t%s\\%s \n", mb, thisdir, fileinfo.cFileName);
        }


And also this code:


     if (level == 1)
        {
        mb = (double) *totalsize / 1024.0 / 1024.0;
        printf ("%9.3f Mb %6ld file%s  %s \n", 
                mb, 
                *totalfiles,
                *totalfiles == 1 ? " " : "s",
                thisdir);
        }


To this:


     if (level == 1)
        {
        mb = (double) *totalsize / 1024.0 / 1024.0;
        printf ("%9.3f\t%6ld\t%s \n", 
                mb, 
                *totalfiles,
                thisdir);
        }