如何从朱莉娅的工作目录中删除文件?



如何从 Julia 中的当前目录中删除文件?

R中是否有像file.remove()这样的直接函数?

是的,有rm.请参阅Julia in-REPL帮助(您可以通过按?访问(:

help?> rm
search: rm permute! normpath permutedims permutedims! PermutedDimsArray uperm operm gperm isperm powermod VecOrMat invperm invpermute! rem rem2pi argmin argmax promote promote_type promote_rule promote_shape
rm(path::AbstractString; force::Bool=false, recursive::Bool=false)
Delete the file, link, or empty directory at the given path. If force=true is passed, a non-existing path is not treated as error. If recursive=true is passed and the path is a directory, then all contents
are removed recursively.
Examples
≡≡≡≡≡≡≡≡≡≡
julia> mkpath("my/test/dir");
julia> rm("my", recursive=true)
julia> rm("this_file_does_not_exist", force=true)
julia> rm("this_file_does_not_exist")
ERROR: IOError: unlink: no such file or directory (ENOENT)
Stacktrace:
[...]

所以你可以做rm(filename).

相关内容

  • 没有找到相关文章

最新更新