文件名清理器
清理和消毒文件名,移除Windows、Linux和Mac的非法字符
### 文件名清理器
这个工具可以帮助你:
1. **移除非法字符**:删除所有操作系统禁止的文件名字符
2. **Windows兼容**:移除 < > : " / \ | ? * 和控制字符
3. **Linux/Mac兼容**:移除 / 和空字符
4. **自定义替换**:选择用于替换非法字符的字符
5. **修剪选项**:可选去除首尾空格和点
6. **长度限制**:可选限制文件名最大长度
**Windows非法字符:**
- < (小于)
- > (大于)
- : (冒号)
- " (双引号)
- / (正斜杠)
- \ (反斜杠)
- | (竖线)
- ? (问号)
- * (星号)
- 控制字符 (0-31)
**使用场景:**
- 清理用户上传的文件名
- 准备文件名用于跨平台使用
- 批量重命名文件
- 防止文件系统错误
API 文档
请求端点
POST /zh/api/tools/filename-sanitizer
请求参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| filename | text | 是 | - |
| replacementChar | text | 否 | Character to replace illegal characters with |
| trimWhitespace | checkbox | 否 | Remove leading and trailing whitespace |
| trimDots | checkbox | 否 | Remove leading and trailing dots (can cause issues in some systems) |
| maxLength | number | 否 | Maximum filename length (0 = no limit, Windows typically limits to 255) |
响应格式
{
"result": "Processed text content",
"error": "Error message (optional)",
"message": "Notification message (optional)",
"metadata": {
"key": "value"
}
}
文本:
文本
AI MCP 文档
将此工具添加到您的 MCP 服务器配置中:
{
"mcpServers": {
"elysiatools-filename-sanitizer": {
"name": "filename-sanitizer",
"description": "清理和消毒文件名,移除Windows、Linux和Mac的非法字符",
"baseUrl": "https://elysiatools.com/mcp/sse?toolId=filename-sanitizer",
"command": "",
"args": [],
"env": {},
"isActive": true,
"type": "sse"
}
}
}
你可以串联多个工具,比如:`https://elysiatools.com/mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp`,最多20个。
如果遇见问题,请联系我们:[email protected]