Delete a file from script using wildcards?


I would like to delete, from within a script, a file with name, for example, where the number is not known, a priori. I have been trying variations on

run(`rm foo-*`)

but have not managed to come up with anything that works. There is a message about quoting special characters like “*”, but trying that does not help. TIA


You need to use Julia glob rather than shell wildcards

using Glob
for f in glob("foo-*")

or if you’re using v0.6 or later

using Glob


Thanks, that does the trick. I had overlooked Glob.jl