删除所有与Chef中的正则表达式匹配的文件 [英] Deleting all files matching a regular expression in chef

查看:73
本文介绍了删除所有与Chef中的正则表达式匹配的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的厨师食谱删除与某个正则表达式匹配的所有文件。

I would like my chef recipe to delete all files that match a certain regex. What would be the way to go about this?

推荐答案

您可以使用 execute 您的食谱中的资源:

You could use an execute resource in your recipe:

execute "Deleting files ... " do
    command "find . -regex 'REGEX' -delete"
    cwd "/path/to/folder"
    action :run
end

命令期望目标系统具有 find 命令。

The command expects a target system having the find command.

这篇关于删除所有与Chef中的正则表达式匹配的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆