找到https://pub.dev/documentation/io/latest/io/copyPath.html(或相同的同步版本),这似乎对我有用。它是 io 包https://pub.dev/documentation/io/latest/io/io-library.html的一部分,可在https://pub.dev/packages/io上找到。
它的作用相当于cp -R <from> <to>.
不,据我所知不存在。但 Dart 支持从目录中读取和写入文件的基本功能,因此理所当然地可以通过编程方式解决这个问题。
查看我发现的可以完成此过程的工具的要点。
基本上,您将在目录中搜索要复制的文件并执行复制操作:
newFile.writeAsBytesSync(element.readAsBytesSync());
Run Code Online (Sandbox Code Playgroud)
new Path(element.path);到. 文件中的所有文件路径 , new Directory(newLocation);。
编辑:
但这是非常低效的,因为整个文件必须由系统读入并写回文件。您可以只使用 Dart 生成的 shell 进程来为您处理该进程:
Process.run("cmd", ["/c", "copy", ...])
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
593 次 |
| 最近记录: |