but that does not work because this '/Users/floswald/git/ReproWorkshop/code/*' is different from /Users/floswald/git/ReproWorkshop/code/*. The problem is the star character:
julia> Base.run(`rm -rf $(ReproData.root())/code/*`)
ERROR: LoadError: parsing command `rm -rf $(ReproData.root())/code/*`: special characters "#{}()[]<>|&*?~;" must be quoted in commands
It has nothing to do with quoting. As explained in the old thread you just resurrected, wildcards like * are a feature of a shell, not a feature of rm, so you need to execute a shell, e.g.
run(`sh -c "rm -rf $(ReproData.root())/code/*"`)
Of course, this is not portable because not all systems have sh or rm. You could also do it in Julia, something like:
foreach(readdir(joinpath(ReproData.root()), "code"), join=true)) do filename
rm(filename, recursive=true, force=true)
end
or using the Glob.jl package for more flexibility.
I don’t understand the need for an IOBuffer in that example. Why not just define a string with the desired script directly and pass it to powershell, rather than writing a string to a buffer and then converting back to a string?