Given a directory full of Prairie datasets, this script performs the following actions:
- Converts each dataset to compressed OME-TIFF. There will be one OME-TIFF file per dataset, rather than the potentially thousands of single-plane TIFF files in a Prairie dataset. It stores these OME-TIFFs in a mirror of the directory structure in a separate base folder.
- Archives each entire original Prairie dataset as a ZIP file, again in a mirrored, separate directory structure.
- Lastly, if the conversion and archiving both were successful, it deletes the original folder to save space (though if you do not want this, of course it can be disabled in the script).
To save more space, the ZIP files can then be moved to an offsite backup server using a smart syncing tool (e.g., arRsync for OS X works well, though there are many options).
- The script works only on OS X and Linux, not Windows. (Though it might work with Cygwin; this is untested.)
- Do not press Ctrl+C to kill the script during OME-TIFF conversion; it will not terminate properly and may delete original data that was not successfully archived first.
Save the script to a folder of your choice. Then execute it from the command line (e.g., Terminal on OS X):
/path/to/prairie-backup.sh MyData MyTIFFs MyZIPs
/path/tois where you saved the script
MyDatais the base directory containing your Prairie datasets
MyTIFFsis the directory structure in which to store the converted OME-TIFFs
MyZIPsis the directory structure in which to store the ZIP archives
If MyTIFFs or MyZIPs directories do not exist, they will be automatically created.