Quantcast
Channel: How can I prevent a folder from being inadvertently deleted by myself? - Super User
Viewing all articles
Browse latest Browse all 8

Answer by beppe9000 for How can I prevent a folder from being inadvertently deleted by myself?

$
0
0

An effective solution could be moving the folder out of the desktop and then setting up a NTFS junction using the MKLINK command.

C:\Users\Administrator>MKLINK

Creates a symbolic link.

MKLINK [[/D] | [/H] | [/J]] Link Target
        /D      Creates a directory symbolic link.  Default is a file
                symbolic link.
        /H      Creates a hard link instead of a symbolic link.
        /J      Creates a Directory Junction.
        Link    specifies the new symbolic link name.
        Target  specifies the path (relative or absolute) that the new link
                refers to.

So in your case the command would be:

MKLINK /J %userprofile%\Desktop\ImportantFolder D:\ImportantFolder

Where D:\ImportantFolder is the actual folder and %userprofile%\Desktop\ImportantFolder is the junction.

Notes:

  • The Junction doesn't have to bear the same name of the source folder.
  • The junction is not a copy, is in fact a redirection another way to access your folder. Imagine it like the foldr version of a normal (*.lnk) shortcut.
  • Junctions differ from normal shortcut to folders in that they are totally transparent to programs.
  • If the junction is deleted the actual folder is not deleted.
  • But, any file modification is the same as going to D:\ImportantFolder and doing things. So if you delete a passwords.txt file in the junction, you have deleted it from d:/ImportantFolder too.
  • If you accidentally delete the junction, you create it again.

Graphical (More Efficient Easier) Way (With Contextual Menu Extension)

You can instead install Link Shell Extension then you move your folder somewhere else, right-click it and select Pick link source... then you right-click your desktop and select drop as... -> Junction. And you are done.

This is the first application I install on fresh systems, as it is an extremely useful solution. I strongly recomend this if you wil ever have to manage junctions or hard/symbolic links on your pc.


Viewing all articles
Browse latest Browse all 8

Latest Images

Trending Articles





Latest Images