rename-files-date-prefix
Installation
SKILL.md
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_libraryto get the library ID.
2. Get the Library Schema
- Call
get_list_schemato confirm the library hasCreatedandFileLeafReffields and to understand the structure.
3. Retrieve All Files (Including Subfolders)
- Call
get_list_item_metadatawithfetchAll: trueto 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>