Rename Files Date Prefix logo

Rename Files Date Prefix

Organization
pnp
rename-files-date-prefix

Renames all files in a SharePoint document library (including subfolders) to prefix them with their created date in yyMMdd format (e.g., 251203-Status Report.pdf). Offers a preview before committing changes. Use when the user asks to prefix filenames with dates or add date prefixes to files.

Overview

Publisherpnp
Repositorysharepoint-skills
Skill namerename-files-date-prefix
Stars
141
Forks
60
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by pnp on GitHub. Read the source before you install it.

Installation

Install the Rename Files Date Prefix AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/pnp/sharepoint-skills/tree/main/Skills/rename-files-date-prefix/rename-files-date-prefix
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/pnp/sharepoint-skills.git /tmp/sharepoint-skills
mkdir -p .claude/skills
cp -r /tmp/sharepoint-skills/Skills/rename-files-date-prefix/rename-files-date-prefix .claude/skills/rename-files-date-prefix
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Rename Files Date Prefix in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Rename Files Date Prefix on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Rename Files Date Prefix is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Rename Files with Date Prefix

Rename all files in a SharePoint document library to prefix them with their created date in yyMMdd format (e.g., 251203-Status Report.pdf).

Steps

1. Identify the Target Library

  • Use the current document library if the user doesn't specify one.
  • Call get_current_list_or_library to get the library ID.

2. Get the Library Schema

  • Call get_list_schema to confirm the library has Created and FileLeafRef fields and to understand the structure.

3. Retrieve All Files (Including Subfolders)

  • Call get_list_item_metadata with fetchAll: true to retrieve all items.
  • Use a CAML query that filters to files only (FSObjType = 0):
    <Query><Where><Eq><FieldRef Name='FSObjType'/><Value Type='Integer'>0</Value></Eq></Where><OrderBy><FieldRef Name='FileLeafRef' Ascending='TRUE'/></OrderBy></Query>

4. Build the Preview

For each file returned:

  1. Extract the Created date and format it as yyMMdd (2-digit year, 2-digit month, 2-digit day).
  2. Get the current filename from FileLeafRef.
  3. Determine the folder path from FileRef (strip the filename to get the folder).
  4. Skip check: If the filename already matches the pattern ^\d{6}- (six digits followed by a hyphen), mark it as skipped with reason "Already has date prefix".
  5. Build the new filename: yyMMdd-OriginalFilename.

5. Show the Preview Table

Always show the preview before making any changes. Present a markdown table:

#Current NameNew NameFolderStatus
1Status Report.pdf251203-Status Report.pdf/sites/Team/DocsWill rename
2251203-Budget.xlsx251203-Budget.xlsx/sites/Team/Docs/FinanceSkipped (already prefixed)

Include a summary:

  • Total files found: X
  • To be renamed: Y
  • Skipped: Z

Then ask: "Ready to rename Y files? Confirm to proceed."

6. Rename on Confirmation

Once the user confirms:

  • For each file to be renamed, call update_list_items with:
    • itemId: the file's list item ID
    • fieldInternalNames: ["FileLeafRef"]
    • newValues: ["yyMMdd-OriginalFilename"]
  • Process files one at a time to handle errors gracefully.
  • If a rename fails, log the error and continue with the remaining files.

7. Report Results

After processing, show a summary:

  • Successfully renamed: X files
  • Skipped (already prefixed): Y files
  • Errors: Z files (list the filenames and error details)

Date Formatting Rules

  • Use the file's Created date (not Modified).
  • Format: yyMMdd — 2-digit year, 2-digit month (zero-padded), 2-digit day (zero-padded).
  • Example: December 3, 2025 → 251203
  • Example: January 15, 2024 → 240115
  • Time zone: SharePoint returns Created in UTC. Format the prefix from the site's regional time zone, not raw UTC, so a file uploaded at 23:30 local time keeps its local-day date. If the site time zone cannot be determined, fall back to UTC and tell the user once in the preview header ("Dates are formatted in UTC — set the site regional settings to use local time.").

Edge Cases

  • Already prefixed files: Skip any file whose name starts with 6 digits followed by a hyphen (^\d{6}-).
  • Folders: Never rename folders — only process items where FSObjType = 0.
  • Subfolders: Process files in all subfolders recursively (use fetchAll: true).
  • Duplicate names after prefixing: If the proposed yyMMdd-Name already exists in the same folder, do not rename and do not overwrite. Mark the file as Skipped (name collision) in the preview / results with the conflicting target name shown. Never append numeric suffixes (-1, -2) to disambiguate — the user must resolve the conflict manually. The other files in the batch still rename.
  • Special characters: Preserve the original filename exactly as-is after the prefix.
  • Empty libraries: If no files match the CAML query, tell the user the library has no files to rename and stop — do not show an empty preview table.

Resuming after a mid-batch failure

Long runs can be interrupted — throttling, network drop, the user closing the chat. The skill must be safe to re-run from scratch without any extra bookkeeping:

  • The ^\d{6}- skip check automatically excludes every file that was successfully renamed in the previous run. Re-running picks up exactly where the failure stopped.
  • If a file failed mid-rename (rare — SharePoint renames are atomic), it will still match the original name and be processed again in the next run.
  • Do not keep an external "already processed" list, lock file, or marker column. The filename itself is the source of truth.
  • After a partial run, the Step 7 results report must clearly distinguish Renamed, Skipped (already prefixed), Skipped (name collision), and Errors so the user can decide whether to re-run.

Example

User: "Prefix all files in this library with their created date"

Agent response (preview):

#Current NameNew NameFolderStatus
1Quarterly Review.docx250915-Quarterly Review.docx/sites/Team/ReportsWill rename
2241101-Notes.pdf241101-Notes.pdf/sites/Team/ReportsSkipped (already prefixed)
3Budget.xlsx250301-Budget.xlsx/sites/Team/FinanceWill rename

Total files: 3 | To rename: 2 | Skipped: 1

Ready to rename 2 files? Confirm to proceed.

Constraints

  • Never rename without showing the preview first.
  • Never rename folders.
  • Never double-prefix files.
  • Never append numeric suffixes to resolve name collisions — mark as Skipped (name collision) instead.
  • Always process errors gracefully — one failure should not stop the entire batch. Safe to re-run; the ^\d{6}- skip check protects already-renamed files (see Resuming after a mid-batch failure).

Frequently asked questions

What does the Rename Files Date Prefix AI skill do?

Renames all files in a SharePoint document library (including subfolders) to prefix them with their created date in yyMMdd format (e.g., 251203-Status Report.pdf). Offers a preview before committing changes. Use when the user asks to prefix filenames with dates or add date prefixes to files.

Why use Rename Files Date Prefix on TypingMind?

Because you install it once and use it with any model. Rename Files Date Prefix is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Rename Files Date Prefix in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/pnp/sharepoint-skills/tree/main/Skills/rename-files-date-prefix/rename-files-date-prefix. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Rename Files Date Prefix?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Rename Files Date Prefix?

As many as you like. As long as a model supports skills, you can use Rename Files Date Prefix with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Rename Files Date Prefix AI skill free?

Yes. It is published on GitHub by pnp under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇