我可以简单地“读”的文件正在使用中? [英] Can I simply 'read' a file that is in use?

查看:120
本文介绍了我可以简单地“读”的文件正在使用中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用一个StreamReader读取文件,但它始终是由另一个进程使用,所以我得到这个错误:

I am trying to use a StreamReader to read a file, but it is always in use by another process so I get this error:

该进程无法访问该文件
  '\\ arfjwknasgmed17 \\ C $ \\ FLAG
  条件\\ CP-ARFJN-FLAG.XLS',因为
  它被另一个过程

The process cannot access the file '\arfjwknasgmed17\C$\FLAG CONDITION\CP-ARFJN-FLAG.XLS' because it is being used by another process.

有没有一种方法可以让我读这不复制呢?或者是我唯一的选择?

Is there a way I can read this without copying it? Or is that my only option?

推荐答案

您可以读取该文件仅当打开该文件的程序首先指定在该文件中读取的共享权限。

You can read the file only if the program that opened the file first specified read sharing rights on that file.

如果该文件确实没有读共享权限虽然,你将无法把它摆在首位复制。

If the file does indeed have no read sharing rights though, you wouldn't be able to copy it in the first place.

您可能无法如果你指定与已经打开的文件的程序的共享权冲突的共享权来访问文件。例如,你不能授予写访问,如果已经有了它打开该程序不授予写访问。

You may not be able to access a file if you are specifying a sharing right that conflicts with the sharing right of a program that already has the file opened. For example you can't grant write access if the program that already has it opened isn't granting write access.

如果说在第一时间打开该文件的程序支持卷影复制(VSS),你也可以使用VSS来访问该文件。

If the program that opened the file in the first place supports Volume Shadow Copy (VSS), you can also use VSS to gain access to the file.

有商业软件驱动程序,允许您访问这些文件,即使他们都在使用。你曾经是能够通过圣Bernards旅馆得到打开文件管理器,你也可以使用 文件访问管理器(FAM) VisionWorks解决方案公司,这些驱动器通常OEM'ed备份软件公司纳入自己的产品。

There are commercial software drivers that allow you to access such files, even when they are in use. You used to be able to get Open File Manager by St-Bernards, and you can also use File Access Manager (FAM) by VisionWorks Solutions Inc. These drivers are typically OEM'ed to backup software companies for inclusion in their products.

VSS的作品告诉了该文件的已打开另一个程序想从文件中读取程序。 VSS然后执行该文件的副本,让您从这个副本读。 VSS不遗留应用程序。

VSS works by telling the program that has the file opened already that another program would like to read from the file. VSS then does a copy of the file and lets you read from this copy. VSS does not work for legacy applications.

FAM透明地通过指定可以访问独占方式打开和锁定文件的应用程序的允许列表适用于传统和非传统程序的一致好评。在此列表中的程序只允许访问这些文件。当一个文件被打开,它进入缓存模式,让您将获得文件的副本,因为它是在文件的备份/打开开始。此时,原本打开该文件的程序看到文件作为它实际上是,第二个方案在允许列表中看到文件,因为它是在文件的打开/备份'发生了。这保证了文件的一致性。

FAM transparently works for legacy and non-legacy programs alike by specifying an 'allowed list' of applications that can access exclusively opened and locked files. Only programs in this list are allowed access to these files. When a file is being opened, it goes into cache mode so that you will obtain a copy of the file as it was when the 'backup/open' of the file started. At this point the program that originally opened the file sees the file as it actually is, and the second program in the allowed list, sees the file as it was when the 'open/backup' of the file happened. This ensures consistency of the file.

这篇关于我可以简单地“读”的文件正在使用中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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