如何复制打开的文件 [英] How do I copy a file which is open

查看:78
本文介绍了如何复制打开的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用CopyFile在PC上定期备份某些文件。但是,在我调用CopyFile时,这些文件可能已被其他应用程序打开以供写入,我担心这可能会导致问题,无论是应用程序写入文件还是复制操作本身。



有没有办法复制已经打开的文件(写作)?



谢谢。



如果发布两次,出现问题,请致歉!



我尝试过:



我查看了卷影复制服务,但这似乎是针对完整的卷备份而不仅仅是特定文件。

I am using CopyFile to make periodic backup copies of certain files on a PC. However, these files might have been opened for writing by other applications at the time I call CopyFile and I am concerned that this may cause problems, either with the application writing to the file or with the copy operation itself.

Is there a way to copy files that are already opened (for writing)?

Thanks.

Apologies if this is posted twice, something went wrong signing in!

What I have tried:

I looked at the Volume Shadow Copy service but this appears to be for complete volume backups and not just specific files.

推荐答案

在大多数情况下,为打开而打开的文件将以独占访问权限打开,因此尝试打开它们进行读取将失败。如果你想使用卷影服务复制这样的文件是 - 据我所知 - 唯一的解决方案。



你可能看看GitHub - candera / hobocopy:适用于Windows的开源备份工具 [ ^ ]和 GitHub - candera / shadowspawn:一个安装卷影副本的Windows实用程序驱动器号中的磁盘,然后生成一个任意命令。 [ ^ ]。两者都支持复制单个文件。它们不再处于活跃开发状态,但源可能有助于使用卷影服务实现复制文件。
In most cases files opened for writing will be opened with exclusive access so that trying to open them for reading will fail. If you want to copy such files using the Volume Shadow Service is - as far as I know - the only solution.

You might have a look at GitHub - candera/hobocopy: An open source backup tool for Windows[^] and GitHub - candera/shadowspawn: A Windows utility that mounts a shadow copy of the disk at a drive letter and then spawns an arbitrary command.[^]. Both support copying of single files. They are no no longer under active development but the sources may be helpful to implement copying files using the Volume Shadow Service.


这篇关于如何复制打开的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆