multiple files

User 1033cfd7dc

08-05-2007 10:22:52

Hello,





I would like to convert my mol files to another format with one command





it is possible in babel:





babel -imol *.mol -osmi -m,





where "-m" means separated files.





However, babel does not recognise Chemaxon's mol format in some cases, e.g. when a group is inserted in the structure.





Is it possible to do this kind of conversion with molconvert? I need to keep the name of the files.





Thanks,


Zsolt

ChemAxon 7c2d26e5cf

16-05-2007 13:53:59

You can convert multiple files into one file (e.g. SD file) by molconverter script:


Code:
molconvert sdf *.mol > mols.sdf



To convert multiple mol files into separate files (in another format) is a bit complicated.


I can recommend two ways:


1. Call molconvert for each molecule and write batch file or a script to do automatize it. The capability of Unix shell scripts are very flexible and writing a simple script is very easy


Code:
#!/bin/sh





# Unix shell script to convert all mol files in the current directory to smiles.





FILES=`ls *.mol`


for f in $FILES


do


    echo "Convert $f to smiles format: $f.smiles"


    ./scripts/molconvert smiles $f > $f.smiles


done



2. Write a custom Java application by using the MolConverter API





Meanwhile, I've found a suitable custom application for your request.


Originally, I wrote this example application to export compounds to separate image files. Iinstead of "jpeg" format, give the the required output format (e.g. "smiles"). convert mol files into image as a batch program