{
  "id": "KcowKE6mvyQ37CQH",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "File Renamer Bot",
  "tags": [],
  "nodes": [
    {
      "id": "883c5dad-85eb-4a9e-8165-ce3eb5f6d6ac",
      "name": "Set Formatted Name",
      "type": "n8n-nodes-base.set",
      "position": [
        144,
        0
      ],
      "parameters": {
        "mode": "raw",
        "include": "none",
        "options": {},
        "jsonOutput": "={\n  \"newFileName\": \"IMG_{{$json['createdTime'].slice(0,10).replace(/-/g,'')}}_{{$json['createdTime'].slice(11,16).replace(':','')}}.{{$json['fileExtension']}}\",\n  \"Id\": \"{{$json['id']}}\"\n}"
      },
      "typeVersion": 3
    },
    {
      "id": "67daf81b-70ac-4c25-9b4a-5cd600e8f425",
      "name": "Rename File",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        368,
        0
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.Id }}"
        },
        "options": {},
        "operation": "update",
        "newUpdatedFileName": "={{ $json.newFileName }}"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "ea64e098-1b26-4c9e-9f9e-809d14bea7cd",
      "name": "Google Drive Trigger",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        -80,
        0
      ],
      "parameters": {
        "event": "fileCreated",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "list",
          "value": "1GDkSI9txB88oOcu_jr1tXEzkT0_FoGmC",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1GDkSI9txB88oOcu_jr1tXEzkT0_FoGmC",
          "cachedResultName": "Instagram "
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "849fdcb0-7f54-4098-8b58-293c8db4f76a",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -304,
        -448
      ],
      "parameters": {
        "color": 2,
        "width": 272,
        "height": 432,
        "content": "\ud83d\ude80 Google Drive Trigger (Starting Point)\n\nWhat it does:\nActs as the \"sensor\" that watches for new files\nMonitors a specific Google Drive folder called \"Instagram\"\nChecks every minute for newly created files\nWhen a new file is detected, it grabs all the file information (ID, creation time, file extension, etc.)\n\nTechnical Details:\n\nFolder ID:(your Instagram folder)\nPolling: Every minute\nEvent: Only triggers on \"fileCreated\" (not file updates or deletions)\nOutput: Passes file metadata to the next node\n\nReal-world example: When you upload \"photo.jpg\" to your Instagram folder, this trigger activates and sends the file details forward."
      },
      "typeVersion": 1
    },
    {
      "id": "905e22a2-0805-4f0a-a49d-01d4bd31a788",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -112,
        160
      ],
      "parameters": {
        "color": 4,
        "width": 464,
        "height": 448,
        "content": "\ud83d\udcdd Set Formatted Name (Processing)\n\nWhat it does:\nTakes the original file's creation timestamp\nConverts it into a standardized filename format\nCreates a new filename following the pattern: IMG_YYYYMMDD_HHMM.extension\n\nStep-by-step process:\n\nExtract Date: Takes createdTime like \"2024-12-25T14:30:45.123Z\"\nFormat Date: Converts \"2024-12-25\" \u2192 \"20241225\" (removes hyphens)\nExtract Time: Takes \"14:30\" \u2192 \"1430\" (removes colons)\nCombine: Creates \"IMG_20241225_1430.jpg\"\nPreserve ID: Keeps the original file ID for the rename operation\n\nExample transformation:\n\nOriginal: \"vacation_photo.jpg\" (created on Dec 25, 2024 at 2:30 PM)\nNew name: \"IMG_20241225_1430.jpg\""
      },
      "typeVersion": 1
    },
    {
      "id": "eac44807-6a78-454f-bc8a-db49a7e94c6b",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        272,
        -400
      ],
      "parameters": {
        "color": 6,
        "width": 432,
        "height": 352,
        "content": "\u270f\ufe0f Rename File (Final Action)\nWhat it does:\n\nTakes the formatted filename from the previous step\nUses Google Drive API to actually rename the file\nUpdates the file in Google Drive with the new timestamp-based name\n\nTechnical process:\n\nUses the file ID to locate the exact file in Google Drive\nSends an update request to Google Drive API\nChanges the filename to the formatted version\nMaintains all other file properties (content, permissions, etc.)\n\nAuthentication: Requires Google Drive OAuth2 credentials to access and modify files."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "1d6fa6a6-7166-4c20-91dc-52846aa4fac2",
  "connections": {
    "Set Formatted Name": {
      "main": [
        [
          {
            "node": "Rename File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive Trigger": {
      "main": [
        [
          {
            "node": "Set Formatted Name",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}