I think what you&#x27;re describing is called the knapsack problem, so I&#x27;d guess the answer is no. The best you could do is randomly order the files and compress them, and do that a few times and pick the best ordering.