Logo di Rename Files Date Prefix

Rename Files Date Prefix

Organizzazione
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.

Panoramica

Pubblicato dapnp
Repositorysharepoint-skills
Nome della skillrename-files-date-prefix
Stelle
141
Fork
60
File inclusi
Solo istruzioni
LicenzaMIT
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • Tutto nelle istruzioni

    Tutto ciò che serve al modello è nelle istruzioni: nessun file aggiuntivo da sincronizzare.

  • Open source

    Pubblicata da pnp su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Rename Files Date Prefix in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/pnp/sharepoint-skills/tree/main/Skills/rename-files-date-prefix/rename-files-date-prefix
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Aggiungi skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella della skill nella directory delle skill di quell'agente.

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
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Rename Files Date Prefix in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Rename Files Date Prefix non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Rename Files Date Prefix non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

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).

Domande frequenti

Cosa fa la skill IA 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.

Perché usare Rename Files Date Prefix su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Rename Files Date Prefix è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che la skill smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Rename Files Date Prefix in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/pnp/sharepoint-skills/tree/main/Skills/rename-files-date-prefix/rename-files-date-prefix. TypingMind legge il file SKILL.md e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Rename Files Date Prefix?

Qualsiasi modello che colleghi a TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Rename Files Date Prefix?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Rename Files Date Prefix: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Rename Files Date Prefix è gratuita?

Sì. È pubblicata su GitHub da pnp con licenza MIT. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, template o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Elenco completo

Crea subito il tuo spazio di lavoro AI

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇