最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

azure - Using find command to delete accented folder name during release causes error - Stack Overflow

programmeradmin6浏览0评论

In my Pipeline, I have a Stage that runs a Powershell script that sends a find command to my app service (Linux) to delete files in /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 = "/api/command"  
    Headers = @{Authorization=("Basic {0}" -f $base64AuthInfo)}  
    Method = "POST"  
    Body = (ConvertTo-Json $bodyToPOST)  
    ContentType = "application/json"  
}  
# Invoke REST call  
Invoke-RestMethod @param 

I have a folder named méli-mélo and it seems to be causing an error. How would I formulate my find to not have this happen? Or is this due to another configuration issue?

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

There seems to be an encoding process that kicks in, converting the accented é to their unicode equivalents?

Update #1

Running the command manually on the app service (via SSH or Bash tabs) actually worked:

In my Pipeline, I have a Stage that runs a Powershell script that sends a find command to my app service (Linux) to delete files in /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 

I have a folder named méli-mélo and it seems to be causing an error. How would I formulate my find to not have this happen? Or is this due to another configuration issue?

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

There seems to be an encoding process that kicks in, converting the accented é to their unicode equivalents?

Update #1

Running the command manually on the app service (via SSH or Bash tabs) actually worked:

Share Improve this question edited Mar 20 at 13:52 TechFanDan asked Mar 19 at 14:07 TechFanDanTechFanDan 3,51210 gold badges52 silver badges91 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

Yes, looks like, the problem is caused by the folder name (méli-mélo) that contains non English characters, and the character é was convert to numeric character reference. If you manually execute the same find command directly on the Console of your Azure Web App, you might get the same issue.

To delete the folder "méli-mélo", you can try to execute a rm command to delete it individually under the directory "/home/site/wwwroot". Then execute the find command to delete other folders.

rm -r "méli-mélo"
find . -mindepth 1 -delete

After successfully clear all files and folders from the web app, in the future deployments, you can consider naming the folders with general English characters to avoid this issue.

If the rm command also cannot work, you might need to delete the whole web app, and then create a new web app on the Azure Portal. Same, in the future deployments, you can consider naming the folders with general English characters to avoid this issue.

发布评论

评论列表(0)

  1. 暂无评论