A computer program product for migrating data files to magnetic tape according to a query having one or more predefined criterion and one or more query expansion profiles, the computer program product comprising a computer readable storage medium having program instructions embodied therewith, the program instructions readable and/or executable by a controller to cause the controller to:
- perform, by the controller, a query for finding files that meet at least one predefined criterion, wherein the at least one predefined criterion includes a file size that is less than a predefined fraction of a predetermined threshold file size,
- wherein performing the query includes, in response to finding a first file that meets the at least one predefined criterion, sequentially performing additional querying, wherein each sequence of additional querying incorporates a different predefined query expansion profile for finding additional files that meet the at least one predefined criterion;
- as files are found in the additional querying, for each sequence of additional querying, determine, by the controller, whether a total storage size of files found during performance of the query exceeds the predetermined threshold file size;
- in response to a determination that the total storage size of the files found during performance of the query exceeds the predetermined threshold file size, consolidate, by the controller, the files into a consolidation file;
- and
- write, by the controller, the consolidation file to a magnetic recording tape.