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.
I could use 'FileUtils' to delete the files with the matching condition. Since FileUtils is pure ruby command, i have to embed this code inside a ruby_block in my chef cookbook.
The below statement worked for me