AutomationFlowsGeneral › Automatic File Renaming with Timestamp Format for Google Drive

Automatic File Renaming with Timestamp Format for Google Drive

ByRahul Joshi @rahul08 on n8n.io

Description:

Event trigger★★☆☆☆ complexity6 nodesGoogle DriveGoogle Drive Trigger
General Trigger: Event Nodes: 6 Complexity: ★★☆☆☆ Added:

This workflow corresponds to n8n.io template #6610 — we link there as the canonical source.

This workflow follows the Google Drive → Google Drive Trigger recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "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
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Description:

Source: https://n8n.io/workflows/6610/ — original creator credit. Request a take-down →

More General workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

General

Automate document translation and ensure translation accuracy using Straker Verify, Google Drive and Slack.

N8N Nodes Straker Verify, Google Drive, Google Drive Trigger
General

This workflow contains community nodes that are only compatible with the self-hosted version of n8n. Monitors Google Drive for new video file uploads Downloads and processes videos using VLM Run AI tr

@Vlm Run/N8N Nodes Vlmrun, Google Drive Trigger, Google Drive +1
General

A minimal workflow to convert a Revit/IFC/DWG project into analysis-ready XLSX (and optional DAE) with a single run. Set two variables, execute, and the converter does the rest. Inputs: and (RVT/IFC/D

Execute Command
General

Convert Document for Knowledge Base. Uses n8n-nodes-iterationlayer. Event-driven trigger; 4 nodes.

N8N Nodes Iterationlayer
General

Convert Image Format. Uses n8n-nodes-iterationlayer. Event-driven trigger; 4 nodes.

N8N Nodes Iterationlayer