Sunday, July 30, 2017

Script to group files/directories to reach the closest desired/target size.

Program takes a list of files and directories as a set of last arguments and outputs the paths of each of the files/directories which has been selected to reach the target size (which is the first argument). Will ignore files which do not exist.

First argument -- target size in bytes.

Off the selected files, will print each of them in a new line with their size, separated with a tab in the same line. Specify units as KB, MB, GB, TB in the environment variable UNIT.

script --

Before you run, install run 'gem install ClosestSum' on your system as root. This'll install the
ClosestSum gem which's a library implementing the algorithm.

No comments:

Post a Comment