[Solved] Use the new folderreport() on all drives

Discuss and share scripts and script files...
iycgtptyarvg
Posts: 222
Joined: 10 Jun 2008 15:40
Location: Netherlands

[Solved] Use the new folderreport() on all drives

Post by iycgtptyarvg »

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?
Last edited by iycgtptyarvg on 21 May 2016 21:56, edited 1 time in total.
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into
(")_(") your signature to help him gain world domination.

highend
Posts: 13309
Joined: 06 Feb 2011 00:33

Re: Use the new folderreport() on all drives

Post by highend »

Do what exactly? How should the output look like?
One of my scripts helped you out? Please donate via Paypal

iycgtptyarvg
Posts: 222
Joined: 10 Jun 2008 15:40
Location: Netherlands

Re: Use the new folderreport() on all drives

Post by iycgtptyarvg »

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.
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into
(")_(") your signature to help him gain world domination.

highend
Posts: 13309
Joined: 06 Feb 2011 00:33

Re: Use the new folderreport() on all drives

Post by highend »

Again, what is the expected output?
One of my scripts helped you out? Please donate via Paypal

iycgtptyarvg
Posts: 222
Joined: 10 Jun 2008 15:40
Location: Netherlands

Re: Use the new folderreport() on all drives

Post by iycgtptyarvg »

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.
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into
(")_(") your signature to help him gain world domination.

highend
Posts: 13309
Joined: 06 Feb 2011 00:33

Re: Use the new folderreport() on all drives

Post 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");
One of my scripts helped you out? Please donate via Paypal

iycgtptyarvg
Posts: 222
Joined: 10 Jun 2008 15:40
Location: Netherlands

Re: Use the new folderreport() on all drives

Post by iycgtptyarvg »

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.
Last edited by iycgtptyarvg on 19 May 2016 11:47, edited 1 time in total.
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into
(")_(") your signature to help him gain world domination.

admin
Site Admin
Posts: 60531
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Use the new folderreport() on all drives

Post 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.

iycgtptyarvg
Posts: 222
Joined: 10 Jun 2008 15:40
Location: Netherlands

Re: Use the new folderreport() on all drives

Post by iycgtptyarvg »

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.
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into
(")_(") your signature to help him gain world domination.

admin
Site Admin
Posts: 60531
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Use the new folderreport() on all drives

Post by admin »

I posted an example in the release notes:
http://www.xyplorer.com/release_16.80.php#Reporting

iycgtptyarvg
Posts: 222
Joined: 10 Jun 2008 15:40
Location: Netherlands

Re: Use the new folderreport() on all drives

Post by iycgtptyarvg »

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?
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into
(")_(") your signature to help him gain world domination.

admin
Site Admin
Posts: 60531
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Use the new folderreport() on all drives

Post 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).

iycgtptyarvg
Posts: 222
Joined: 10 Jun 2008 15:40
Location: Netherlands

Re: Use the new folderreport() on all drives

Post by iycgtptyarvg »

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.
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into
(")_(") your signature to help him gain world domination.

admin
Site Admin
Posts: 60531
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Use the new folderreport() on all drives

Post by admin »

I checked the code and found some things that I could improve. The next version will be MUCH faster. :biggrin:

iycgtptyarvg
Posts: 222
Joined: 10 Jun 2008 15:40
Location: Netherlands

Re: Use the new folderreport() on all drives

Post by iycgtptyarvg »

Hooray!!!!

Now I'm glad I kept testing and trying. :biggrin:
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into
(")_(") your signature to help him gain world domination.

Post Reply