zotfile icon indicating copy to clipboard operation
zotfile copied to clipboard

How to use "date added" to rename files

Open qiuqianyuanluo opened this issue 4 years ago • 2 comments

I already read the description and this question but still don't know how to write the right sentence. I've tried several times. the example "%4" doesn't seem like it matches that description Could you help me with it?

qiuqianyuanluo avatar Nov 26 '20 10:11 qiuqianyuanluo

Could you please be a bit more specific about what you've tried? Have you copy and pasted the custom JSON (found here and quoted below for easy access) into your zotfile.wildcards.user preference?

{
    "1": "publicationTitle",
    "2": {
        "default": "publicationTitle",
        "book": "publisher",
        "bookSection": "publisher"
    },
    "3": {
        "field": "title",
        "regex": "([\\w ,-]{1,50})[:\\.?!]?",
        "group": 1
    },
    "4": {
        "default": {
            "field": "title",
            "regex": "([\\w ,-]{1,10})[:\\.?!]?",
            "group": 1,
            "transform": "upperCase"
        },
        "journalArticle": "publicationTitle"
    }
}

ahrendsen avatar Nov 27 '20 22:11 ahrendsen

After some research, it seems that the example JSON has changed. The correct one for #130 should be:

{
    "1": "publicationTitle",
    "2": {
        "default": "publicationTitle",
        "book": "publisher",
        "bookSection": "publisher"
    },
    "3": {
        "field": "title",
        "operations": [{
            "function":"exec",
            "regex": "([\\w ,-]{1,50})[:\\.?!]?",
            "group": 1
        }]
    },
    "4": {
        "field":"dateAdded",
        "operations": [{
            "function": "replace",
            "regex": "(\\d{4})-(\\d{2})-(\\d{2})(.*)",
            "replacement": "$1$2$3",
            "flags":"g"
        }]
    },
    "5": {
        "default": {
            "field": "title",
            "operations": [
                {
                    "function":"replace",
                    "regex": "\\d",
                    "replacement": ""
                },
                {
                    "function": "exec",
                    "regex": "([\\w ,-]{1,10})[:\\.?!]?",
                    "group": 1
                },
                {
                    "function": "toUpperCase"
                },
                {
                    "function": "trim"
                }
            ]
        },
        "journalArticle": "publicationTitle"
    }
}

jleaves avatar May 24 '22 05:05 jleaves