2.3 Invoking convert-ly

The convert-ly command uses the \version number in the input file to detect older versions. In most cases it is sufficient just to run

convert-ly -e myfile.ly

in the directory containing the input file; this upgrades myfile.ly in-place and preserves the original file by renaming it to myfile.ly~. The \version number in the upgraded input file, along with any required syntax updates, is also changed.

When run, the convert-ly command outputs the version numbers of which conversions have been made to. If no version numbers are listed in the output for the file, it is already up to date and using the latest LilyPond syntax.

Note: For each new version of LilyPond, a new convert-ly command is created. However, not every version of LilyPond needs syntax changes for its input files from the version before. This means that the convert-ly command only converts input files up to the latest syntax change it has and this, in turn, may mean that the \version number left in the upgraded input file is sometimes lower than the version of the convert-ly command itself.

To convert all input files in a single directory, use

convert-ly -e *.ly

as a command. To handle all input files that reside in different subdirectories, try

find . -name '*.ly' -exec convert-ly -e '{}' \;

to recursively search and convert them in the current directory and all directories below it. The converted files will be located in the same directory along with their renamed originals.

On Windows, execute

forfiles /s /M *.ly /c "cmd /c convert-ly -e @file"

instead. The forfiles command also accepts an explicit path to the top level of your folder containing all the sub-folders that have input files in them by using the /p option.

forfiles /s /p C:\Documents\MyScores /M *.ly /c "cmd /c convert-ly -e @file"

If there are spaces in the path to the top-level folder, the whole path needs to be inside double quotes, for example

forfiles /s /p "C:\Documents\My Scores" /M *.ly /c "cmd /c convert-ly -e @file"

LilyPond Application Usage v2.25.21 (development-branch).