It would be useful to be able to arrange compressed files based on their uncompressed type. I see the following use cases:
The compressed file decompresses to a single file. The uncompressed file extension is in the name of the compressed file.
E.g. my_file.csv.gz decompresses to my_file.csv and so is sent to Documents. Simultaneously, my_script.py.zip decompresses to my_script.py so is sent to Other.
In this case the file type can be inferred from the name by stripping off compression type suffix.
The compressed file decompresses to a single file. The uncompressed file extension is not visible in the compressed file name.
E.g. my_file.gz decompresses to my_file.csv
Requires looking inside the compressed file.
The compressed file decompresses to multiple files. The uncompressed files all have the same type and the uncompressed file extension is in the compressed file name. E.g. all_my_files.csv.gz decompresses to file1.csv, file2.csv etc.
I doubt this would be common, but it could be treated the same as case 1. We wouldn't be able to differentiate between cases 1 and 3 without looking inside the compressed file.
The compressed file decompresses to multiple files, which have different types. E.g. all_my_files.gz decompresses to file1.txt, file2.csv etc.
Requires looking inside the compressed file. It is possible the decompressed files would not belong to the same category, so we would be unable to arrange the compressed file anyway.
I propose a new flag called -arrangeCompressed which will support cases 1 and 3.
The logical flow would be: Does the file have an extension indicating that it is a compressed file?
No:
Ignore this file and do not move it.
Yes:
Strip off the compressed file extension.
Arrange the file based on what is left.
Caveats:
If all_my_files.csv.gz contains files of multiple types, they will all be sorted based on a .csv extension. I think this is still sensible behaviour.
Another option would be to add two flags: -arrangeCompressed and -arrangeCompressedOnly. -arrangeCompressedOnly behaves as I have described above. -arrangeCompressed behaves as above except that files that are not compressed are arranged rather than ignored.
I can submit a PR for either of these options. Keen to hear your thoughts.