*! version 1.0.0 21august2022

supercompress -- Compress all datasets throughout a folder and its subfolders

Syntax

supercompress, toplevel(filepath)

Description

supercompress attempts to reduce the amount of memory used by your data by running compress on every Stata dataset it can find within the filepath you specify in the toplevel option. This includes all datasets directly within your top level filepath and all datasets within all subfolders of your top level filepath, including subfolders of subfolders and so on.

This command finds every file within toplevel and its subfolders, opens each one individually, runs compress on it, and then saves the file. As such, if you maintain massive drives with lots of folders (like the collaborative Record Linking Lab shared network drive this program was designed for), this will probably take quite a while to run.

Because this program resaves the files, it updates the "Last Modified" date on every file, so if you rely on "Last Modified" dates to organize your data, don't use this command until you have another way to organize it.

I also do not have the programming skills to have supercompress tell you whether there was an error and stuff broke or whether it actually didn't save any data. Both of those return 0 bytes saved in all cases I've tested.

Option

toplevel requires a string filepath within its parentheses. It does not require double quotes within the parentheses unless the filepath has a space in it.

Remarks

Sorry about making you type toplevel as an option. I couldn't figure out a way to make it run on just a filepath. This is my first custom program for Stata, so send any feedback you have to labhours@tmorg.org and it will be very appreciated!