File Renaming
CiteDesk can name attachment files automatically from the metadata of their parent reference; the default names look like "Author - Year - Title.pdf". The settings are under Settings > General > File Renaming.
The file name template
A template consists of plain text and variables enclosed in {{ … }}. The default template is:
{{ firstCreator suffix=" - " }}{{ year suffix=" - " }}{{ title truncate="100" }}
A variable can take arguments, written as name="value":
| Argument | Effect |
|---|---|
prefix, suffix | add this text before or after the variable when it has a value; nothing is added when the variable is empty |
truncate | keep at most this many characters |
start | start taking characters from this position |
case | change case or naming style: upper, lower, sentence, title, hyphen, snake, camel, pascal |
match | keep only the first part that matches this regular expression |
replaceFrom, replaceTo | replace the part matching replaceFrom with replaceTo |
regexOpts | options of the regular expressions, vi by default |
The available variables are the fields of the reference (for example title, publicationTitle, DOI); firstCreator; year; itemType; accessDate; attachmentTitle; and the three name lists authors, editors and creators (with arguments such as max, name, join and initialize) and their …Count.
Conditions can be written too: {{ if year }}…{{ elseif … }}…{{ else }}…{{ endif }}. When a template has an error the window tells you, and the default template is used when saving.
The preview in the window uses the currently selected reference, or a sample reference if none is selected. The Rename Files… button renames the existing references of the library in one batch with the new template, shows a preview first, and changes names only after you confirm.
When files are renamed
- Automatically rename files: when on, files obtained by adding from a URL, adding by identifier, finding full text and recognizing a PDF are named from the template; when you add a file under a reference, it is renamed only if the reference has no other file of the same kind.
- Rename files of these types: PDFs and ebooks by default; images, audio and video can be ticked as well.
- While "Automatically rename files" is on, editing the fields of a reference also renames its main attachment file along with it by default.
- You can also rename a file by hand with Rename File to Match Parent Reference in the attachment row menu of the right pane.
Renaming changes only the file name; the title of the attachment stays the same, see Attachment title and file name. A name that is longer than the file system allows is shortened until it fits.
Linked files
"Rename linked files" is off by default: a file linked to somewhere on your own computer is something you organized yourself, and the application leaves it alone by default. When on, such files are also renamed from the template, and it is the file on disk that is renamed.