Page 1 of 2
[Solved] Use the new folderreport() on all drives
Posted: 19 May 2016 08:23
by Sander Bouwhuis
For some time now I've been using this script to index all the files on my harddisks to make sure I can check what to do in the event of a harddisk crash:
Code: Select all
"Drive structure"
folderreport("bcsv", "file", "C:\", "r", "E:\Storage\Documents\Drive structure.csv");
folderreport("bcsv", "file", "D:\", "ra", "E:\Storage\Documents\Drive structure.csv");
folderreport("bcsv", "file", "E:\", "ra", "E:\Storage\Documents\Drive structure.csv");
I tried to replace the lines with what the help file said:
Code: Select all
"Drive structure"
folderreport("treeitems:{dir \"C:"\" ({size mb}, {count} items)|{name}; {size kbr}; {modified yyyy-mm-dd_hh:nn:ss}}", "r", "E:\Storage\Documents\Drive structure NEW.csv", "r");
folderreport("treeitems:{dir \"D:"\" ({size mb}, {count} items)|{name}; {size kbr}; {modified yyyy-mm-dd_hh:nn:ss}}", "ra", "E:\Storage\Documents\Drive structure NEW.csv", "r");
folderreport("treeitems:{dir \"E:"\" ({size mb}, {count} items)|{name}; {size kbr}; {modified yyyy-mm-dd_hh:nn:ss}}", "ra", "E:\Storage\Documents\Drive structure NEW.csv", "r");
I tried different combinations, but I don't understand what to do.
Please help?
Re: Use the new folderreport() on all drives
Posted: 19 May 2016 08:26
by highend
Do what exactly? How should the output look like?
Re: Use the new folderreport() on all drives
Posted: 19 May 2016 08:30
by Sander Bouwhuis
The original script logs all the directories and files on my harddisks and saves them to the "E:\Storage\Documents\Drive structure.csv" file.
I would like to still do that, but now using the new tree style added to the folderreport() routine.
Re: Use the new folderreport() on all drives
Posted: 19 May 2016 08:34
by highend
Again, what is the expected output?
Re: Use the new folderreport() on all drives
Posted: 19 May 2016 08:41
by Sander Bouwhuis
The changelist stated:
"Reporting. The scripting command folderreport() now can generate a rich tree-shaped recursive report on any folder. (Pro Edition Only)"
So, I would like to see whether the tree style format works better for me than the flat style I've been using so far.
Re: Use the new folderreport() on all drives
Posted: 19 May 2016 09:09
by highend
Ok, then I'm guessing...
Code: Select all
$drives = "C:\|D:\|E:\";
while ($i++ < gettoken($drives, "count", "|")) {
$drive = gettoken($drives, $i, "|");
if !($drive) { continue; }
$flags = "r";
if ($i > 1) { $flags = "ra"; }
folderreport("treeitems:{dir $drive ({size mb}, {count} items)|{name}; {size kbr}; {modified yyyy-mm-dd_hh:nn:ss}}", "f", $drive, $flags, "E:\Storage\Documents\Drive structure NEW.csv");
}
Or if you really want the $drive in double quotes replace the folderreport line with:
Code: Select all
folderreport("treeitems:{dir ""$drive"" ({size mb}, {count} items)|{name}; {size kbr}; {modified yyyy-mm-dd_hh:nn:ss}}", "f", $drive, $flags, "E:\Storage\Documents\Drive structure NEW.csv");
Re: Use the new folderreport() on all drives
Posted: 19 May 2016 11:00
by Sander Bouwhuis
Ok, I used your script to write my own:
Code: Select all
"Drive structure"
folderreport("treeitems:{dir C:\ ({size mb}, {count} items)|{name}; {size kbr}; {modified yyyy-mm-dd_hh:nn:ss}}", "f", "C:\", "r", "E:\Storage\Documents\Drive structure NEW.csv");
folderreport("treeitems:{dir D:\ ({size mb}, {count} items)|{name}; {size kbr}; {modified yyyy-mm-dd_hh:nn:ss}}", "f", "D:\", "ra", "E:\Storage\Documents\Drive structure NEW.csv");
folderreport("treeitems:{dir E:\ ({size mb}, {count} items)|{name}; {size kbr}; {modified yyyy-mm-dd_hh:nn:ss}}", "f", "E:\", "ra", "E:\Storage\Documents\Drive structure NEW.csv");
Unfortunately, it's useless. My original script takes about 2.5 minutes to complete. The new script has been running now for almost 2 hours and hasn't even finished with drive C:\.
Can a developer look into the performance? There clearly appears to be a problem.
Edit:
I killed Xyplorer with the task manager after 2.5 hours because I have to go. This feature is not very useful as it is now.
Re: Use the new folderreport() on all drives
Posted: 19 May 2016 11:04
by admin
It's clear: you are telling XY to collect the recursive folder size of each folder, and in scripting context no folder size caching is used.
Re: Use the new folderreport() on all drives
Posted: 19 May 2016 21:27
by Sander Bouwhuis
Hmmm... ok. But I used what it said in the help file... that's why I tried to get that to work first.
I don't need the sizes of the directories anyway, so it's no loss to me to not have them count/calculate them.
So, to only show the sizes of the files and not the directories, how should I change the lines?
Thanks for all the help.
Re: Use the new folderreport() on all drives
Posted: 19 May 2016 21:53
by admin
Re: Use the new folderreport() on all drives
Posted: 20 May 2016 11:28
by Sander Bouwhuis
Ok, I changed the script to:
Code: Select all
"Drive structure"
folderreport("treeitems:{dir C:\|{name}; {size raw}; {modified yyyy-mm-dd hh:nn:ss}}", "f", "C:\", "r", "E:\Storage\Documents\Drive structure NEW.csv");
folderreport("treeitems:{dir D:\|{name}; {size raw}; {modified yyyy-mm-dd hh:nn:ss}}", "f", "D:\", "ra", "E:\Storage\Documents\Drive structure NEW.csv");
folderreport("treeitems:{dir E:\|{name}; {size raw}; {modified yyyy-mm-dd hh:nn:ss}}", "f", "E:\", "ra", "E:\Storage\Documents\Drive structure NEW.csv");
It is faster, but it still took more than 2 hours to do the 3 partitions.
What else do I need to change to get it as fast as the original script?
Re: Use the new folderreport() on all drives
Posted: 20 May 2016 11:41
by admin
And your original script takes 2.5 minutes for the same job?
I currently measure a difference only by factor 6 (still a lot, but much smaller than your results).
Re: Use the new folderreport() on all drives
Posted: 20 May 2016 14:21
by Sander Bouwhuis
Yes, the original script takes exactly 2:46.
The result has 636.757 lines and is 162.012.726 bytes.
The 'new' script takes more than 2 hours.
The result has 739.781 lines and is 115.936.852 bytes.
Re: Use the new folderreport() on all drives
Posted: 20 May 2016 15:29
by admin
I checked the code and found some things that I could improve. The next version will be MUCH faster.

Re: Use the new folderreport() on all drives
Posted: 20 May 2016 15:53
by Sander Bouwhuis
Hooray!!!!
Now I'm glad I kept testing and trying.
