I will probably kick myself after this but I have created a method within my cucumber application that will delete all files in a directory but it doesn't seem to execute as the files still exist after running it, though if i jump into my console and run the commands step by step it works.
Any reason why this would not work when calling the method itself?
def clean_reports
js_error_path = File.join(File.dirname(__FILE__), '/report/js_errors')
screenshot_path = File.join(File.dirname(__FILE__), '/report/screenshots')
FileUtils.rm_rf(Dir.glob(js_error_path + '/*'))
FileUtils.rm_rf(Dir.glob(screenshot_path + '/*'))
end
What would be handy is if I could just call FileUtils.rm_rf
just once? is this possible?
My directory structure is like so
-cucumber_tests
-report
-js_errors
(files)
-screenshots
(files)
Thanks
以下行将有所帮助,
FileUtils.rm_rf(Dir['./report/js_errors', './report/screenshots'])
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.