I have been looking for a chef ruby code to delete multiple files in a directory matching on a file name string
Lets say if my D drive contains the file names - eula1.txt, eula2.txt, res1.dll, res2.dll, pvn1.txt, pvn2.txt
In the above example, i would need a chef ruby code which i can include in the cookbook to delete all occurrences of a file starting with eula* and res*, i.e it should delete 4 files in the directory
My Final output should contain only 2 files - pvn1.txt,pvn2.txt in the directory.
Your best bet is to use an
executeresource like:While it is possible to do this with direct file deletion, it is much more complex and probably out of scope for you.