How do I add a column with whether a file is bigger than 1GB? (Through which I will color files bigger than 1GB)

Discussion related to "Everything" 1.5 Alpha.
Post Reply
TenTickles
Posts: 7
Joined: Thu Aug 01, 2024 10:03 pm

How do I add a column with whether a file is bigger than 1GB? (Through which I will color files bigger than 1GB)

Post by TenTickles »

Some attempts that failed: `addcolumn:a a:=($size:>1GB)`, `addcolumn:a a:=($size: >1000000000)`, `addcolumn:a a:=($size:)>1GB`;

The coloring part should be much easier. I just plan on using: `dupe:something_goes_here groupcolors:`;
NotNull
Posts: 5517
Joined: Wed May 24, 2017 9:22 pm

Re: How do I add a column with whether a file is bigger than 1GB? (Through which I will color files bigger than 1GB)

Post by NotNull »

There are probably other ways, but the following seems the simplest (in my mind):

Code: Select all

addcolumn:A < size:>1GB A:=1 > | A:=0 
or if you don't care about the "0" in the A-column when size <= 1GB:

Code: Select all

addcolumn:A < size:>1GB A:=1 > | 
Explanation:
<> : groups partial searches.
| : OR
searchpart1 | searchpart2 : If searchpart1 matches, there is no more need to searchpart2

searchpart1 = size:>1GB A:=1 : If file/folder size > 1GB, A will be set to 1
searchpart2 = A:=0 : For all files/folders where size <= 1GB, searchpart2 will be "executed". It will set column A to 0 (or empty, in the second example)


If you are just interested in files (so not folders), add file: to your search:

Code: Select all

file:  addcolumn:A < size:>1GB A:=1 > | A:=0 
TenTickles
Posts: 7
Joined: Thu Aug 01, 2024 10:03 pm

Re: How do I add a column with whether a file is bigger than 1GB? (Through which I will color files bigger than 1GB)

Post by TenTickles »

That does exactly what I wanted! Thank you! : )

But I don't know how to generalize it. Would you perhaps helping figure out how to do it for three labels? (>2GB , vs >1GB, vs neither) I tried to adapt your partial search syntax but it didn't work.

And if it's not trouble if you know how to do it using

Code: Select all

IFS(condition1,result1,condition2,result2,...)
that'd be great too.

Edit:
The below worked, but alternatives are more than welcome.

Code: Select all

< size:>2GB A:=2 > | < size:<1GB A:=0 > |  A:=1 

The query that I initially tried is the one below. Before it failed, now it works. I'm not sure why.

Code: Select all

< size:>2GB A:=2 > | < size:>1GB A:=1 > |  A:=0  
TenTickles
Posts: 7
Joined: Thu Aug 01, 2024 10:03 pm

Re: How do I add a column with whether a file is bigger than 1GB? (Through which I will color files bigger than 1GB)

Post by TenTickles »

Query - Color by size category ( >2GB vs 1GB> vs else)

Here is my current query to highlight files per their "size" category. But it's buggy, if I try to sort by anything other than column A it fails.

Code: Select all

addcolumn:A < size:>2GB A:=2 > | < size:>1GB A:=1 > |  A:=0   dupe:A groupcolors: 
NotNull
Posts: 5517
Joined: Wed May 24, 2017 9:22 pm

Re: How do I add a column with whether a file is bigger than 1GB? (Through which I will color files bigger than 1GB)

Post by NotNull »

TenTickles wrote: Wed Dec 04, 2024 4:43 pm And if it's not trouble if you know how to do it using

IFS(condition1,result1,condition2,result2,...)

Code: Select all

addcolumn:A A:=Ifs(size:>2000000000,2,size:>1000000000,1,size:<=1000000000,0) 
(change the numbers to your liking)


TenTickles wrote: Wed Dec 04, 2024 5:12 pm Here is my current query to highlight files per their "size" category. But it's buggy, if I try to sort by anything other than column A it fails.

That is the right query :thumbsup:
dupe: compares item1 with item 2 (and 2 with 3, etc). If they are the same - based on what kind of duplicates you are searching for, it will be put in the same "dupe-group".

When you change the sort (by name), that order will be messed up and duplicates matching using the above described mechanism will fail.

Solution:

Code: Select all

addcolumn:A < size:>2GB A:=2 > | < size:>1GB A:=1 > |  A:=0   dupe:column-A  sort:column-A-descending,name
The key here is in the sort:column-a,name. Primary sort is by column A, so dupes are still sorted together, but within these groups, the results are sorted biy name (secondary sort)

(added descending sort for column-a, because I guess that is what you will ask next ;) )
TenTickles
Posts: 7
Joined: Thu Aug 01, 2024 10:03 pm

Re: How do I add a column with whether a file is bigger than 1GB? (Through which I will color files bigger than 1GB)

Post by TenTickles »

Everything seems to be working and the explanations really help. Thank you so much! :mrgreen:
Post Reply