[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help using convert-ly recursively on Linux

From: Susan Dittmar
Subject: Re: Help using convert-ly recursively on Linux
Date: Fri, 3 Sep 2010 14:11:55 +0200
User-agent: Mutt/1.5.9i

Dear Ralph,

I just wrote two versions using bash. They are untested. Better copy the
whole directory to a backup place before starting

(cp -a . ../<name of the backup version of this directory>)

First version is based on directories. For every directory within the
current directory (including this directory itself) it converts all files
matching *.ly. Might raise problems in case convert-ly does not deal
gracefully with being given '*.ly' as filename which is done in case there
is no such file in the directory.


# search for directories:
for i in `find -type d`
        # change to directory:
        pushd "$i"
        # conversion of all lilypond files in this directory:
        convert-ly -e *.ly
        # back to starting directory:

The second version starts conversion for every lilypond file separately:


# search for lilypond files:
for i in `find -name '*.ly'`
        # change to directory:
        pushd `dirname "$i"`
        # conversion:
        convert-ly -e `basename "$i"`
        # back to starting directory:

I hope that helps,


PS: As to the purpose of these scripts here the quote of the original post:

Quoting Ralph Palmer (address@hidden):
> I'm running LilyPond on Ubuntu 9.10 (Karmic Koala).
> I'd like to run convert-ly against all of my .ly files that I have created,
> without having to manually change directories to each directory that
> contains a file I want to convert, and then run convert-ly against the files
> in that directory. "convert-ly -e *.ly" works in a single directory, but I
> can't figure out how to get it to work recursively through multiple
> directories. Assuming all the .ly files I have created are in a single
> directory hierarchy, like:
> /SheetMusic
>     /Classical
>         /Bach
>             /ArtOfTheFugue
>             /SoloCelloSuites
>         /Beethoven
>             /Sonatas
>             /StringQuartets
>         /Mozart
>     /FolkMusic
>         /NorthAmerican
>         /EasternEuropean
> and that the directory structure might change (while always beginning from a
> single parent directory), can anyone either point me in the right direction
> or share a script file (preferably python or bash, since I'm more likely to
> understand what's going on with those) to run convert-ly recursively on the
> files each and all of the directories under /SheetMusic?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]