我目前有一个没有文件夹结构的图像数据集。但是,根据现有的图像名称,我想重命名文件并将其移动到不同的文件夹结构(假设文件夹存在,我也可以以编程方式创建文件夹)。
在 Python 中,我只需重命名该文件,它就会移动到我指定的更新位置。如何在 Julia 中重命名文件?
在 Julia 的基本文件系统中,有一个mv命令可用于移动和重命名文件,如下所示:
julia> write("hello.txt", "world"); # here we create a text file.
julia> mv("hello.txt", "goodbye.txt") # we then move it, but the file stays in the same dir so it is just renamed from hello to goodbye.
"goodbye.txt"
julia> mv("goodbye.txt", "./test/hello.txt") # in this example, we actually move the file from the existing folder into a new test folder as well as change the name.
"./test/hello.txt"
julia>
Run Code Online (Sandbox Code Playgroud)
mv您可以在 Julia 文档中阅读有关该函数的更多信息。
| 归档时间: |
|
| 查看次数: |
1315 次 |
| 最近记录: |