How to best compare sets of files according to their sizes?

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
Hacker
Moderator
Moderator
Posts: 13073
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

How to best compare sets of files according to their sizes?

Post by *Hacker »

Hi all,
[Panos-style post]
I have about 2500 PNGs in one dir which I wanted to convert to JP2, JPC and LWF and see if I get any size reduction. However, this gave me ~ 10000 files, since each .PNG got its name-mates in .JP2, JPC and LWF. To compare the sizes I went through the list manually and deleted the 3 largest files of each name. Took me about three hours.
Now, is there a better way I missed?
And as I sometimes need to do such size comparisons (eg pack something with different packers to see which one does best) I am thinking about writing a tool which would do this automatically (if no one suggests a better way).
[/Panos-style post]

TIA
Roman
User avatar
JackFoo
Senior Member
Senior Member
Posts: 373
Joined: 2003-02-05, 19:53 UTC
Location: ERROR

Post by *JackFoo »

Hmm, that's a very interesting problem... I haven't been able to find a [full] simple solution, but I did find a nice shortcut for at least part of the way. It lets you sort the files by (name, size, extension): which would lead the following (second column is size):

[original list, sorted by name]
a.1 0
a.2 1
a.3 6
b.1 2
b.2 4
b.3 1

to become [sorted by name, size, extension]:
a.1 0
a.2 1
a.3 6
b.3 1
b.1 2
b.2 4

now you delete every item that his [place in list (starting with 0) modulo 3] (or in general case modulo number of trials per file) is not 0. Even doing it manually is still simpler.

Ok, how to do it:
select files
multi-rename
sort by size
rename mask: [N][C]

now you get the files
a0.1
a1.2
b2.3
b3.1
a4.3
b5.2

sorted by name they become:
a0.1
a1.2
a4.3
b2.3
b3.1
b5.2
======= sorted by (name, size, extension) . Presto

Notes:
1. Pad the counter correctly.
2. This solution can let you sort files by any combination of attributes supported by multi-rename, with any ascending/descending definition. Very nice bonus if you ask me.

How to complete:
If I could specify a counter based on a formula ([C]%3 or something) this solution would have worked. A nice thing to have if you ask me, and should be simple to add, allowing very powerful file management.

Cheers.
User avatar
pdavit
Power Member
Power Member
Posts: 1529
Joined: 2003-02-05, 21:41 UTC
Location: Kavala -> Greece -> Europe -> Earth -> Solar System -> Milky Way -> Space
Contact:

Re: How to best compare sets of files according to their siz

Post by *pdavit »

Hacker wrote:[Panos-style post]
So, it's becoming widely accepted?! :D :D ;)
"My only reason for still using M$ Window$ as an OS is the existence of Total Commander!"
Christian Ghisler Rules!!!
User avatar
Hacker
Moderator
Moderator
Posts: 13073
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

JackFoo,
Thank you, very interesting. I have written a small tool anyways, is probably much more comfortable. http://thehacker.host.sk/myfiles/soc_1_0.zip (SFV: C9D19339; MD5: 32932AD8FF5B2E293A46EA13CD6158C4). It can list the small files or directly delete the large ones.


pdavit,
So, it's becoming widely accepted?!

Almost an ISO standard. ;)

Thanks
Roman
Post Reply