How can I determine if a file to open a file descriptor was deleted in Windows using Perl?

I have a process with an open file descriptor file. I need to determine if this file was deleted by another process (there may be a file with the same name in its place). On UNIX, I compared the indices of my file descriptor and the file path via stat, but this does not work on Win32. How can I do this in Perl?

Thanks,
Peter

+3
source share
4 answers

I may be wrong (I am not a Windows programmer), but I thought that files cannot be deleted or replaced when they open in Win32, or at least by default this is not possible.

+7

, Windows Unix.

. , ? , - , , . , ? ? SQLite Berkley DB .

+2

, mtime atime; , ( , , stat win32, , , ). , , , , , , , - .

+1

Take a look at the Win32 :: ChangeNotify package to register for notification of changes to a file or directory. You can also open the file through the Win32API :: File package so that it cannot be deleted while you open it (see, for example, createFile () and OsFHandleOpen (), as well as CreateFile () documents on MSDN).

+1
source

Source: https://habr.com/ru/post/1705347/


All Articles