nmrfolderfix is a bash script for renaming NMR data folders that have problematic names, specifically folders that are identically named except for case differences (which are unique in Linux but indistinguishable on Windows and Mac), as well as for folders that end in a period (which is permissible on Linux and Mac but not on Windows). The purpose is to allow other scripts (such as https://github.com/greenwoodad/nmrsync) to automatically copy data from the Linux file system that the data was collected on to a windows file system. An email is optionally sent to the NMR manager.
I recommend running this as a cron job every five minutes on each workstation collecting NMR data.
This script requires a linux operating system (I've run it in in CentOS 5.1, 6.8, and 7.5 and AlmaLinux 9.6). I've only tested this with Bruker NMR data, but future releases may be able to handle file structures generated by other instruments.
The email feature requires that the application sendmail is working on the machine running the script.
git clone https://github.com/greenwoodad/nmrfolderfixor
git clone https://(your github username)@github.com/greenwoodad/nmrfolderfix.gitfollowed by:
chmod +x ./nmrfolderfix/nmrfolderfixnmrfolderfix [OPTIONS]... path/to/dataOptions
-h, -?, --help Show help message.
-p, --path Set path to data (flag optional).
-n, --nmr (default 'y') Set to 'y' for the default /(user)/nmr/(data set)/(expt #)
data organization. Set it to 'n' for data organized as
/(user)/(data set)/(expt #)
-e, --email (default '') Provide an email address to receive emails when
folders are renamed.
To run this as a cron job, make an entry in your crontab like this:
*/5 * * * * /path/to/nmrfolderfix '/path/to/data'Users may occasionally save processed data of spectra loaded in Topspin after the folder has been renamed. This will (re)generate a folder with the original dataset name but no fid or ser file. The script will treat this like still-acquiring data and output a message to the spool mail in /var/spool/mail/username every time it is run. This is basically harmless but may be considered clutter and will cause the mail file to grow unnecessarily large. Future versions may deal with this.
Pull requests and bug reports are welcome.
- Alex Greenwood - provided script - Greenwoodad