Quote:
Originally Posted by mgpai
Code:
// Rename files by matching download url pattern
// Trigger: Packagizer Hook
if (state == "BEFORE") {
var patt = /.+\/domain\.com\/(foo)\/(bar)(\.zip)/i;
var name = link.getURL().match(patt);
if (name) link.setName(name[2] + "_" + name[1] + name[3]);
}
Packagizer rules not suitable for this?
|
Is this what I would need to use in the case of creating a directory and subdirectory based on the pinterest url?
example links are
**External links are only visible to Support Staff****External links are only visible to Support Staff**
**External links are only visible to Support Staff****External links are only visible to Support Staff**
mine was more like this with my basic javascript knowledge so, i didn't know exactly how to apply it to this situation
Code:
testVar = document.URL
testVar = **External links are only visible to Support Staff**
const [first, second] = testVar.split("/").filter(n=>n).slice(-2);
if pinterestURL
if the url is in this format,
main folder is first string
subfolder is second string
...
first = stewipanzon
second = english-bull-terrier
Hoping someone can understand my intent