获取任何进程正在编辑的文件名 [英] Get file name being edited by any process

查看:72
本文介绍了获取任何进程正在编辑的文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个在编辑模式下提供文件名的程序.我正在制作备份程序,我需要找到编辑前的文件和编辑后的文件以及编辑后的文件之间的区别.

文件锁定对我来说不是问题.

I need a program which gives file name under editing mode. I am making backup program and I need to find difference between file before editing and file and file after editing.

File locking is not problem with me.

推荐答案

在我看来,您可以做两件事.
首先,并且可能更可取的是,您可以将文件的最后编辑日期与备份系统中的文件日期进行比较.如果计算机上的文件比备份系统中的文件新,则需要对其进行备份.如果备份系统中根本没有文件,则也需要备份该文件.
其次,您可以使用 FileSystemWatcher [
In my opinion there''s two things you could do.
First, and possibly preferent, you could compare the date at which a file was last edited with the date of the file in your backup system. If the file on the machine is newer than the one in your backup system you need to back it up. If a file is not present in your backup system at all you need to back it up too.
Second, you could use a FileSystemWatcher[^] to be notified the moment a file is created, updated, deleted etc.
How you are going to realize any of these (or other methods) is up to you.
Hope it helps! :)


这篇关于获取任何进程正在编辑的文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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