You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

发布阶段使用find命令删除带重音文件夹时出现错误

问题:含重音字符的文件夹导致find命令执行失败

背景

我的Pipeline中有一个Stage运行以下PowerShell脚本,通过REST API向Linux应用服务发送find命令,删除/home/site/wwwroot目录下的文件:

$bodyToPOST = @{  
    command = "find . -mindepth 1 -delete"  
    dir = "/home/site/wwwroot"  
}  
# Splat all parameters together in $param  
$param = @{  
    # command REST API url  
    Uri = "https://app.service.url/api/command"  
    Headers = @{Authorization=("Basic {0}" -f $base64AuthInfo)}  
    Method = "POST"  
    Body = (ConvertTo-Json $bodyToPOST)  
    ContentType = "application/json"  
}  
# Invoke REST call  
Invoke-RestMethod @param 

问题现象

存在一个名为méli-mélo的文件夹,执行脚本时触发错误,错误信息如下:

2025-03-18T16:28:43.8003793Z [32;1mError    : [0mfind: ‘./plugins/path/to/\351li-m\351lo’: No such file or directory
2025-03-18T16:28:43.8005976Z [32;1m           [0mfind: cannot delete ‘./plugins/path/to/m\351li-m\351lo’: No such file or directory

可见文件夹名中的重音字符é被转成了八进制表示的\351,编码转换异常导致find无法识别正确路径。

补充信息

手动在应用服务的SSH或Bash标签中执行相同的find . -mindepth 1 -delete命令时,能够正常完成文件删除操作。

提问

请问该如何调整find命令以避免这个问题?还是说这是由其他配置问题导致的?

内容的提问来源于stack exchange,提问作者TechFanDan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.13 19:24:50