Ruby question-delete files by their suffix; possible?
Posted: Fri Oct 28, 2016 8:30 pm
Hi,
I have this code which is based tulamide's suggestion.
This ruby code deletes a given file from the H.D. if you feed it's string input with the full file's name+location
(for instance: "C:\Users\kortezzzz\Pictures\bla bla.png") and push the trigger input. The problem is that it won't delete as many files as you need (based on their suffix) if you feed it's string input with "*.something" method like the windows "CMD" command line does (for instance: "C:\Users\kortezzzz\Pictures\*.png"). Is there any way to force ruby do it?
I have this code which is based tulamide's suggestion.
- Code: Select all
def event i
if i == "do_it"
File.delete(@path, File.dirname(@path))
end
end
This ruby code deletes a given file from the H.D. if you feed it's string input with the full file's name+location
(for instance: "C:\Users\kortezzzz\Pictures\bla bla.png") and push the trigger input. The problem is that it won't delete as many files as you need (based on their suffix) if you feed it's string input with "*.something" method like the windows "CMD" command line does (for instance: "C:\Users\kortezzzz\Pictures\*.png"). Is there any way to force ruby do it?