lilypond-user
[Top][All Lists]
Advanced

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

Re: bookOutputName still gets "-1" suffix added to SVG file names


From: David Wright
Subject: Re: bookOutputName still gets "-1" suffix added to SVG file names
Date: Thu, 30 Mar 2023 11:11:36 -0500

On Thu 30 Mar 2023 at 07:57:23 (+0200), Jean Abou Samra wrote:
> Le mercredi 29 mars 2023 à 22:56 -0600, Jeff Olson a écrit :
> > I've got to generate a thousand+ cropped SVG files with specified file 
> > names  
> > from one lilypond compilation, so I'm wrapping each score in a \book with  
> > its own \bookOutputName as in this MWE:

> > But the SVG files all have the extra -1 suffix as though there were 
> > additional  
> > files from the same book that would collide:
> > 
> >    32 -rwxrwxrwx+ 1 J None   32199 Mar 29 22:25  Foo-1.svg*  
> >    32 -rwxrwxrwx+ 1 J None   32190 Mar 29 22:25  Abc-1.svg*  
> >    32 -rwxrwxrwx+ 1 J None   32231 Mar 29 22:25  Bar-1.svg*

That looks like a linux platform.

> > My MIDI files don't have this problem since they only add a suffix on  
> > **subsequent** files with the same base name, and there's only one per book.
> > 
> > These "-1" suffices are messing with my URLs for the SVG files,  
> > so I'd appreciate any ideas on how to get rid of them.  Thx.
> 
> They are there for good reason. If any of your `\book`s got output on 
> multiple pages, there would indeed be multiple files output.
> 
> If you never want separate pages, you should not use `separate-page-formats` 
> but `tall-page-formats`.
> 
> By the way, in addition to simplifying automation (like lilypond-book), 
> having `-1.svg` even on the first page makes it possible to use both 
> `separate-page-formats` and `tall-page-formats` at the same time.

If the thousand-odd files are in a single directory, and you like
visual interfaces, renaming them is very simple in a TUI-style
file manager like Midnight Commander (mc). You'd rename (called
Move) from *-1.svg to *.svg after selecting all the files with
the * keystroke.

If you prefer a CLI, then it's as simple as:

  $ cd directory-containing-files
  $ rename 's/-1\.svg$/.svg/' *.svg

except for the complication of which version of rename you have
installed on your system. I prefer the version that uses a Perl
expression, and it's set up as the default on my system for the
"rename" command, but can also be invoked as prename or file-rename.

Where files are scattered amongst directories, the CLI rename command
can be invoked from a find command, which searches directory trees for
suitable filenames to rename.

Cheers,
David.



reply via email to

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