How does Explorer deal with recent files that were renamed?

Raymond Chen


Roni wonders how Explorer manages to keep track of files that were moved or renamed. Specifically, “opening a shortcut to a renamed file actually updates the shortcut’s destination and opens the renamed file. How is this done? Is it an NTFS feature?” This feature has been around since Windows 95. If the target of a shortcut no longer exists, the shell tries to resolve the shortcut; i.e., find the object, wherever it ended up moving to. As I explained several months before the question was posted, the algorithm used by the shell varies depending on the operating system and the file system and your domain policies. Possibly also the phase of the moon, one can never be sure. It’s not that Explorer actually keeps track of the files as they move around, just in case you had a shortcut to them. Rather, the shortcut remembers enough information about the file so that if the file moves, Explorer can try looking for it.

The fact that shortcuts can resolve targets means that shortcuts are a handy tool for keeping track of files that might move around. If you want to keep track of a file, you can just create a shortcut to it (you don’t even need to save it in a file), and when it comes time to find the file, you just resolve the shortcut.


Comments are closed.