8
n8n 中文网amn8n.com

我的工作流程 2

中级

这是一个File Management, Multimodal AI领域的自动化工作流,包含 15 个节点。主要使用 Ftp, Set, Filter, EmailSend, ScheduleTrigger 等节点。 带智能清理和邮件通知的自动化FTP文件迁移

前置要求
  • 无特殊前置要求,导入即可使用
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "DaJFVETQef5qJMmB",
  "meta": {
    "instanceId": "ade915387b18f7a3b9a14fd8fb677fdbace0ade794de7914e8790d907cd285d0",
    "templateCredsSetupCompleted": true
  },
  "name": "我的工作流程 2",
  "tags": [],
  "nodes": [
    {
      "id": "dafe14b7-7719-41b7-b1a4-cf6765aa3db9",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -320,
        -144
      ],
      "parameters": {
        "width": 400,
        "height": 712,
        "content": "# 🚀 FTP 文件迁移工作流"
      },
      "typeVersion": 1
    },
    {
      "id": "f460e190-0e9f-4fb9-b023-2b4d37988a37",
      "name": "文件处理",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        608,
        144
      ],
      "parameters": {
        "width": 380,
        "height": 280,
        "content": "## 📁 文件处理管道"
      },
      "typeVersion": 1
    },
    {
      "id": "d92ebb39-8697-4137-8770-dddf0cc3412a",
      "name": "安全",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -304,
        592
      ],
      "parameters": {
        "width": 382,
        "height": 792,
        "content": "## 🔒 安全最佳实践"
      },
      "typeVersion": 1
    },
    {
      "id": "42886faa-e0ec-4ccc-9bcf-fa289f27fea7",
      "name": "性能",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        128,
        -144
      ],
      "parameters": {
        "width": 444,
        "height": 568,
        "content": "## ⚡ 性能优化"
      },
      "typeVersion": 1
    },
    {
      "id": "51afbebf-2431-4d08-bd8e-74c0a9072eb1",
      "name": "故障排除",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2304,
        -128
      ],
      "parameters": {
        "width": 480,
        "height": 912,
        "content": "## 🔧 故障排除指南"
      },
      "typeVersion": 1
    },
    {
      "id": "d57222c3-5f3b-45ec-8410-3f49675bdf9b",
      "name": "配置",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1136,
        96
      ],
      "parameters": {
        "width": 380,
        "height": 320,
        "content": "## ⚙️ 配置检查清单"
      },
      "typeVersion": 1
    },
    {
      "id": "fd89ccc8-f083-4241-a869-dca7690bc591",
      "name": "每日计划 (凌晨 2 点)",
      "type": "n8n-nodes-base.scheduleTrigger",
      "notes": "SCHEDULE TRIGGER CONFIGURATION:\n\n📅 CURRENT SCHEDULE: Daily at 2:00 AM (server time)\n\n⏰ SCHEDULE EXAMPLES:\n- Daily at specific time: 0 2 * * *\n- Every 6 hours: 0 */6 * * *\n- Weekdays at 8 AM: 0 8 * * 1-5\n- Weekly on Sunday 2 AM: 0 2 * * 0\n- Monthly on 1st at midnight: 0 0 1 * *\n\n🔧 CONFIGURATION STEPS:\n1. Click on this node to edit\n2. Modify 'Cron Expression' field\n3. Use cron expression generator if needed\n4. Test with 'Execute Node' button\n\n⚠️ IMPORTANT CONSIDERATIONS:\n- Server timezone affects execution time\n- Consider maintenance windows\n- Avoid peak business hours\n- Account for server load and resources\n- Plan for daylight saving time changes\n\n💡 TESTING TIP:\n- Use '*/5 * * * *' for every 5 minutes during testing\n- Change back to production schedule after validation\n\n🌍 TIMEZONE SETTINGS:\n- Current: Europe/Warsaw (GMT+1/+2)\n- Modify in workflow settings if needed\n- Ensure consistency across all environments",
      "position": [
        288,
        512
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 2 * * *"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0be802db-9255-45b5-8c93-ca85087969e5",
      "name": "列出文件 - 源 FTP",
      "type": "n8n-nodes-base.ftp",
      "notes": "SOURCE FTP SERVER CONFIGURATION:\n\n🔑 CREDENTIALS SETUP:\n1. Navigate to: Settings → Credentials → Create New\n2. Select 'FTP' credential type\n3. Name: 'Source FTP Server'\n4. Enter connection details:\n   - Host: source-ftp-server.com\n   - Port: 21 (FTP) or 22 (SFTP)\n   - Username: your_username\n   - Password: your_password\n5. Test connection before saving\n\n📁 PATH CONFIGURATION:\n- Absolute path: /home/user/files/\n- Relative path: files/folder/\n- Root directory: /\n- Current example: /source/directory/\n\n🔍 OPERATION SETTINGS:\n- Operation: 'List' (to discover files)\n- Recursive: true (includes subdirectories)\n- Returns file metadata: name, size, date, permissions\n\n⚙️ ADVANCED OPTIONS:\n- Connection timeout: 30 seconds (default)\n- Data timeout: 60 seconds\n- Keep connection alive: true\n- Passive mode: true (recommended)\n\n🛡️ SECURITY RECOMMENDATIONS:\n- Use SFTP (port 22) when possible\n- Enable key-based authentication\n- Implement IP whitelisting\n- Use dedicated service accounts\n- Regular credential rotation\n\n🐛 TROUBLESHOOTING:\n- Connection timeout: Check firewall settings\n- Permission denied: Verify user permissions\n- Path not found: Ensure directory exists\n- Authentication failed: Check credentials\n\n📊 EXPECTED OUTPUT:\n- Array of file objects\n- Each object contains: name, size, date, type\n- Empty array if no files found",
      "position": [
        512,
        512
      ],
      "parameters": {
        "path": "/source/directory/",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "0915fba4-e8a7-4070-bfe6-03d594163495",
      "name": "过滤文件",
      "type": "n8n-nodes-base.filter",
      "notes": "FILE FILTERING & SELECTION:\n\n🔍 CURRENT FILTER LOGIC:\n- File Extension Match: \\.(txt|csv|json|xml)$\n- Case-sensitive matching enabled\n- Regex pattern matching\n\n📝 COMMON FILTER PATTERNS:\n\n📄 DOCUMENTS:\n- Office files: \\.(doc|docx|xls|xlsx|ppt|pptx)$\n- PDF files: \\.pdf$\n- Text files: \\.(txt|rtf|md)$\n\n🖼️ IMAGES:\n- Common formats: \\.(jpg|jpeg|png|gif|bmp)$\n- High-res images: \\.(tiff|tga|raw)$\n- Vector graphics: \\.(svg|eps|ai)$\n\n📊 DATA FILES:\n- Structured data: \\.(csv|json|xml|yaml)$\n- Database files: \\.(sql|db|sqlite)$\n- Log files: \\.(log|txt)$\n\n📦 ARCHIVES:\n- Compressed files: \\.(zip|rar|7z|tar|gz)$\n\n🔧 ADVANCED FILTERING OPTIONS:\n\n📏 SIZE-BASED FILTERING:\n- Add condition: {{ $json.size > 1048576 }} (> 1MB)\n- Small files only: {{ $json.size < 10240 }} (< 10KB)\n- Size range: {{ $json.size >= 1024 && $json.size <= 5242880 }}\n\n📅 DATE-BASED FILTERING:\n- Recent files: {{ $json.date > $now.minus({days: 7}) }}\n- Older files: {{ $json.date < $now.minus({months: 1}) }}\n- Specific date range: Use date comparisons\n\n📛 NAME PATTERN FILTERING:\n- Starts with: ^report_.*\n- Ends with: .*_backup$\n- Contains: .*important.*\n- Exclude pattern: ^(?!temp_).*\n\n⚠️ FILTER BYPASS:\n- Remove this node to transfer ALL files\n- Be cautious with unrestricted transfers\n- Consider disk space and bandwidth\n\n🎯 TESTING FILTERS:\n1. Use 'Execute Node' to test filter logic\n2. Check output to verify correct files selected\n3. Adjust regex patterns as needed\n4. Validate with different file types\n\n💡 PERFORMANCE TIP:\n- Specific filters reduce processing time\n- Avoid overly complex regex patterns\n- Test filters with representative data",
      "position": [
        736,
        512
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "file-filter-condition",
              "operator": {
                "type": "string",
                "operation": "regex"
              },
              "leftValue": "={{ $json.name }}",
              "rightValue": "\\.(txt|csv|json|xml)$"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "76837f02-91d3-47f9-aa45-4814c8fd32d1",
      "name": "下载文件",
      "type": "n8n-nodes-base.ftp",
      "notes": "FILE DOWNLOAD OPERATION:\n\n📥 DOWNLOAD CONFIGURATION:\n- Operation: 'Download File'\n- Binary Property: 'file_data' (stores file content)\n- Dynamic path: {{ $json.name }} (from previous node)\n- Uses same credentials as listing operation\n\n🎯 IMPORTANT SETTINGS:\n- Path Expression: {{ $json.name }}\n- Binary Data Property: file_data\n- Timeout: 300 seconds (5 minutes)\n- Auto-retry: 3 attempts on failure\n\n📊 PERFORMANCE CONSIDERATIONS:\n\n⏱️ TIMEOUT SETTINGS:\n- Small files (<10MB): Default timeout (60s)\n- Medium files (10MB-100MB): 300 seconds\n- Large files (>100MB): 600+ seconds\n- Adjust based on network speed\n\n🗂️ FILE SIZE LIMITS:\n- n8n default: 150MB per execution\n- Large files may cause memory issues\n- Consider file size filtering\n- Split large transfers into batches\n\n🔄 RETRY LOGIC:\n- Automatic retry on network errors\n- 3 attempts with exponential backoff\n- Preserves original file on failure\n- Error details logged for debugging\n\n💾 MEMORY MANAGEMENT:\n- Files stored in n8n temporary memory\n- Automatic cleanup after workflow completion\n- Monitor server RAM usage for large files\n- Consider streaming for very large files\n\n⚠️ ERROR SCENARIOS:\n- Network interruption: Auto-retry enabled\n- File permissions: Check source server access\n- File locked: Retry after delay\n- Disk space: Monitor n8n server storage\n- Timeout: Increase timeout for large files\n\n🔍 MONITORING:\n- Check execution logs for download times\n- Monitor network bandwidth usage\n- Track success/failure rates\n- Set up alerts for repeated failures\n\n🛠️ TROUBLESHOOTING:\n- Download fails: Check file permissions\n- Slow downloads: Verify network speed\n- Timeout errors: Increase timeout setting\n- Memory errors: Reduce batch size or file size limit\n\n📈 OUTPUT DATA:\n- Binary data stored in 'file_data' property\n- Original filename preserved\n- File metadata available for next nodes\n- Ready for upload to destination server",
      "position": [
        960,
        512
      ],
      "parameters": {
        "path": "={{ $json.name }}",
        "options": {},
        "binaryPropertyName": "file_data"
      },
      "typeVersion": 1
    },
    {
      "id": "cee66200-dd84-4a31-b00b-81935cff7e86",
      "name": "上传到目标",
      "type": "n8n-nodes-base.ftp",
      "notes": "DESTINATION FTP UPLOAD:\n\n🎯 UPLOAD CONFIGURATION:\n- Operation: 'Upload File'\n- Source: Binary data from 'file_data' property\n- Dynamic destination path with filename preservation\n- Automatic directory creation enabled\n\n🔑 CREDENTIALS SETUP:\n1. Create separate FTP credential: 'Destination FTP Server'\n2. Verify write permissions on target server\n3. Test connectivity before production use\n4. Use different credentials than source for security\n\n📁 PATH STRUCTURE EXAMPLES:\n\n🗂️ PRESERVE ORIGINAL STRUCTURE:\n/destination/directory/{{ $json.name }}\n\n📅 DATE-BASED ORGANIZATION:\n/files/{{ $now.format('YYYY/MM/DD') }}/{{ $json.name }}\n\n📊 TYPE-BASED ORGANIZATION:\n/files/{{ $json.name.split('.').pop() }}/{{ $json.name }}\n\n👤 USER-BASED ORGANIZATION:\n/users/{{ $json.owner || 'system' }}/{{ $json.name }}\n\n⚙️ UPLOAD OPTIONS:\n\n✅ ENABLED FEATURES:\n- createDirectories: true (auto-create missing folders)\n- preserveTimestamp: true (maintain original dates)\n- overwriteExisting: false (prevent accidental overwrites)\n\n🔄 ADDITIONAL OPTIONS:\n- Resume broken uploads: true\n- Verify after upload: true\n- Atomic upload: true (temp file → rename)\n- Permission setting: 644 (read/write owner, read others)\n\n🛡️ SECURITY MEASURES:\n- Separate credentials for source/destination\n- Write-only permissions where possible\n- Regular credential rotation\n- Audit trail maintenance\n\n⚡ PERFORMANCE OPTIMIZATION:\n- Parallel uploads for multiple files\n- Compression for large text files\n- Resume capability for interrupted transfers\n- Bandwidth limiting for peak hours\n\n🎯 SUCCESS VALIDATION:\n- File existence check after upload\n- Size comparison (source vs destination)\n- Checksum verification (optional)\n- Timestamp preservation validation\n\n⚠️ ERROR SCENARIOS & SOLUTIONS:\n- Disk full: Monitor destination storage\n- Permission denied: Verify write access\n- Connection lost: Auto-retry with backoff\n- Filename conflicts: Use unique naming\n\n📊 MONITORING METRICS:\n- Upload speed (MB/s)\n- Success rate percentage\n- Average file size\n- Total data transferred\n- Error frequency and types\n\n🔧 TROUBLESHOOTING GUIDE:\n- Upload fails: Check destination permissions\n- Slow uploads: Verify network connectivity\n- Directory errors: Ensure path format is correct\n- Authentication issues: Validate credentials\n- File corruption: Enable checksum verification\n\n📈 OUTPUT INFORMATION:\n- Upload success status\n- Destination file path\n- Transfer duration\n- File size confirmation\n- Any warnings or errors",
      "position": [
        1184,
        512
      ],
      "parameters": {
        "path": "/destination/directory/{{ $json.name }}",
        "options": {},
        "binaryPropertyName": "file_data"
      },
      "typeVersion": 1
    },
    {
      "id": "df6e949f-839e-4ab5-80c8-243b16409720",
      "name": "上传成功?",
      "type": "n8n-nodes-base.filter",
      "notes": "SUCCESS VALIDATION:\n\nCHECKS PERFORMED:\n- Upload operation success status\n- File transfer completion\n- No error conditions\n\nNEXT STEPS:\n- TRUE: Proceed to cleanup (delete source)\n- FALSE: Route to error handling\n\nADDITIONAL VALIDATIONS:\n- File size comparison\n- Checksum verification\n- Timestamp validation\n\nCONFIGURATION:\n- Adjust condition based on FTP node output\n- May need to check different properties\n- Test with actual transfer results",
      "position": [
        1408,
        512
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "success-condition",
              "operator": {
                "type": "boolean",
                "operation": "equal"
              },
              "leftValue": "={{ $json.success }}",
              "rightValue": true
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "8e3a057f-f21c-4129-a43d-17960b58b26a",
      "name": "删除源文件",
      "type": "n8n-nodes-base.ftp",
      "notes": "SOURCE FILE CLEANUP:\n\nOPERATION: DELETE\n- Removes file from source server\n- Only after successful upload\n- Prevents duplicate processing\n\nSAFETY MEASURES:\n- Only runs after upload verification\n- Maintains transfer logs\n- Consider backup retention period\n\nALTERNATIVE STRATEGIES:\n1. MOVE to 'processed' folder instead of delete\n2. RENAME with timestamp suffix\n3. ARCHIVE to compressed format\n\nRISK MITIGATION:\n- Test thoroughly before production\n- Implement rollback procedures\n- Monitor deletion operations\n\nIMPORTANT: Disable this step for testing!",
      "position": [
        1632,
        512
      ],
      "parameters": {
        "path": "={{ $json.name }}",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "4c15a875-60ab-462e-a780-1e50337f7ca3",
      "name": "记录成功",
      "type": "n8n-nodes-base.set",
      "notes": "SUCCESS LOGGING:\n\nLOG FIELDS:\n- Timestamp: ISO format with timezone\n- Filename: Original file name\n- Status: SUCCESS indicator\n- File Size: In bytes for monitoring\n- Operation: Type of migration performed\n\nLOGGING ENHANCEMENTS:\n- Add source/destination server info\n- Include transfer duration\n- Record file checksums\n- Track user/process info\n\nOUTPUT OPTIONS:\n1. Database logging (add database node)\n2. File logging (append to CSV/JSON)\n3. External API (webhook notification)\n4. Email notifications\n\nMONITORING:\n- Use for operational dashboards\n- Generate migration reports\n- Track performance metrics",
      "position": [
        1856,
        512
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "log-timestamp",
              "name": "timestamp",
              "type": "string",
              "value": "={{ $now.format('YYYY-MM-DD HH:mm:ss') }}"
            },
            {
              "id": "log-filename",
              "name": "filename",
              "type": "string",
              "value": "={{ $json.name }}"
            },
            {
              "id": "log-status",
              "name": "status",
              "type": "string",
              "value": "SUCCESS"
            },
            {
              "id": "log-filesize",
              "name": "file_size_bytes",
              "type": "number",
              "value": "={{ $json.size }}"
            },
            {
              "id": "log-operation",
              "name": "operation",
              "type": "string",
              "value": "MIGRATE_AND_DELETE"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "18f4a55b-d5d5-4c44-8116-70614e4b01c6",
      "name": "发送邮件成功警报",
      "type": "n8n-nodes-base.emailSend",
      "notes": "EMAIL SUCCESS NOTIFICATION:\n\n📧 SUCCESS NOTIFICATION SETTINGS:\n- Sends confirmation email for successful transfers\n- Includes transfer details and file information\n- Uses same SMTP credentials as error notifications\n- Helps maintain audit trail of all operations\n\n✅ EMAIL CONTENT:\n- Timestamp of successful completion\n- Filename and size of transferred file\n- Operation type and status confirmation\n- Summary of all workflow steps completed\n\n📬 NOTIFICATION FREQUENCY:\n- One email per successful file transfer\n- Can be modified to send daily/weekly summaries\n- Consider batch notifications for high-volume transfers\n\n⚙️ CUSTOMIZATION OPTIONS:\n\n📊 SUMMARY REPORTS:\n- Change to HTML format for better presentation\n- Include charts or statistics\n- Add file thumbnails for images\n- Include transfer speed metrics\n\n📝 CONTENT MODIFICATIONS:\n- Add recipient-specific information\n- Include business context or next steps\n- Add links to file locations\n- Include compliance or audit information\n\n👥 RECIPIENT MANAGEMENT:\n- Multiple recipients with CC/BCC\n- Different notifications for different teams\n- Role-based notification content\n- Escalation for VIP files or large transfers\n\n🔕 NOTIFICATION CONTROL:\n- Add conditions to skip notifications for certain files\n- Time-based notification suppression (e.g., only during business hours)\n- File size thresholds for notifications\n- Success rate thresholds (only notify if multiple successes)\n\n📈 REPORTING INTEGRATION:\n- Can feed into business intelligence systems\n- Generate compliance reports\n- Track SLA compliance\n- Monitor operational efficiency\n\nNOTE: For high-volume environments, consider implementing batch notifications to avoid email flooding",
      "position": [
        2080,
        512
      ],
      "webhookId": "aef3fd9a-2a48-4e76-9900-5a48015a67cf",
      "parameters": {
        "options": {
          "allowUnauthorizedCerts": false
        },
        "subject": "✅ FTP Migration Success - {{ $now.format('YYYY-MM-DD HH:mm') }}",
        "toEmail": "admin@yourcompany.com",
        "fromEmail": "noreply@yourcompany.com"
      },
      "typeVersion": 2.1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "ff89656f-95ee-4c16-a998-16763e6a5b23",
  "connections": {
    "Log Success": {
      "main": [
        [
          {
            "node": "Send Email Success Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Files": {
      "main": [
        [
          {
            "node": "Download File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download File": {
      "main": [
        [
          {
            "node": "Upload to Destination",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Success?": {
      "main": [
        [
          {
            "node": "Delete Source File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Delete Source File": {
      "main": [
        [
          {
            "node": "Log Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Daily Schedule (2 AM)": {
      "main": [
        [
          {
            "node": "List Files - Source FTP",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload to Destination": {
      "main": [
        [
          {
            "node": "Upload Success?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List Files - Source FTP": {
      "main": [
        [
          {
            "node": "Filter Files",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Email Success Alert": {
      "main": [
        []
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

中级 - 文件管理, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
中级
节点数量15
分类2
节点类型6
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

外部链接
在 n8n.io 查看

分享此工作流