H44R
H44R

Reputation: 13

FileSytemWatcher: GetLongPathName for a deleted file

I have the following function:

[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
public static extern int GetLongPathName(
    [MarshalAs(UnmanagedType.LPTStr)]
    string path,
    [MarshalAs(UnmanagedType.LPTStr)]
    StringBuilder longPath,
    int longPathLength
);

This works with files and folder paths that are available on the device. But if I have a DELETED item then I get an empty string. The path of the deleted item which comes from the FilesystemWatcher looks something like this 'C:\abc\FIRSTF~1\SECOND~1\THIRDF~1\FOURTH~1\FIFTHF~1....\AVIA~1.jpg'.

Is there a way to get the long path of a deleted item?

Upvotes: 1

Views: 91

Answers (0)

Related Questions