镜像文件夹,带有轻微的修改
我必须“几乎”镜像两个文件夹。 一个文件夹包含具有文件格式的工具的输出 *_Output.txt。随着工具的运行,此处不断添加文件,并且将产生数十万个文件。 另一个应该包含与另一个工具的输入相同的文件,但是该工具期望格式为 *_input.txt
我的当前解决方案是a powershell 脚本,该脚本通过第一个文件夹循环,请检查是否已重命名的文件存在,如果不存在,则使用copy-item
复制和重命名。但是,一旦文件编号足够高,这证明这将非常低效。我想改善这一点。
是否可以以某种方式利用Robocopy的 /mir并在第二个文件夹中重命名文件?我想防止如果存在更名的文件,请防止镜像。
有可能吗?
I have to "almost" mirror two folders.
One folder contains the output from a tool with the file format *_output.txt. Files are continuously added here as the tool runs and it will produce hundreds of thousands of files.
The other one should contain the same files as input for another tool, but that tool expects the format to be *_input.txt
My current solution is a powershell script that loops through the first folder, checks if the renamed file exists and if it doesn't, copies and renames it with Copy-Item
. This, however, is proving very inefficient once the file number goes high enough. I would like to improve this.
Is it possible to somehow make use of robocopy's /MIR and also rename files in the second folder? I would like to prevent the original files being mirrored if a renamed file exists.
Is such a thing possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用filesystemwatcher:
You could use FileSystemWatcher: