我正在尝试根据Year_Quarter_Month.pdf之类的文件名动态创建Folder结构,并将该文件复制到目标文件夹结构\ Year \ Quarter \ Month.pdf
该方法需要指导...源FTP位置,目标位置到OneDrive或Box文件夹。
谢谢 R
答案 0 :(得分:0)
您可以利用split
function从文件名中获取年份,季度和月份。并使用Parse JSON
操作获取这些值作为令牌,您可以在以后的操作中使用它们。
以下是您如何在自己的工作流程中实现此目标的摘要
这是完整的Workflow JSON供参考
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Build_Path": {
"inputs": {
"variables": [
{
"name": "path",
"type": "string",
"value": "@{body('Parse_JSON')?['year']}/@{body('Parse_JSON')?['quarter']}/@{body('Parse_JSON')?['month']}.@{body('Parse_JSON')?['extension']}"
}
]
},
"runAfter": {
"Parse_JSON": [
"Succeeded"
]
},
"type": "InitializeVariable"
},
"Filename": {
"inputs": {
"variables": [
{
"name": "filename",
"type": "string",
"value": "2020_Q3_08.pdf"
}
]
},
"runAfter": {},
"type": "InitializeVariable"
},
"Parse_JSON": {
"inputs": {
"content": {
"extension": "@{split(variables('filename'), '.')[1]}",
"month": "@{split(split(variables('filename'), '.')[0], '_')[2]}",
"quarter": "@{split(split(variables('filename'), '.')[0], '_')[1]}",
"year": "@{split(split(variables('filename'), '.')[0], '_')[0]}"
},
"schema": {
"properties": {
"extension": {
"type": "string"
},
"month": {
"type": "string"
},
"quarter": {
"type": "string"
},
"year": {
"type": "string"
}
},
"type": "object"
}
},
"runAfter": {
"Filename": [
"Succeeded"
]
},
"type": "ParseJson"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {},
"triggers": {
"manual": {
"inputs": {
"schema": {}
},
"kind": "Http",
"type": "Request"
}
}
},
"parameters": {}
}