I have a very important folder on my Desktop. I occasionally clean up my desktop and I am very concerned that I might delete the mentioned folder inadvertently. Is there a way to prevent such a disaster without limiting my frequent read-write operations on the folder's content? Note I don't mind deleting the content inside the folder one by one on occasion but the folder itself matters to me. If it is deleted, I lose a lot of efforts.
Don't try to avoid the inevitable. Use backups and version control.
You could deny yourself the Delete permission though. Deleting files and folders within that directory is a separate permission that you could also disable when required.
There is a better solution to your problem: move the folder to a more appropriate place (e.g. %USERPROFILE%\Documents)
If you must have access to the folder from the Desktop, you can always create a shortcut. This ensures that while you might accidentally delete the shortcut, you never actually delete the folder or its precious contents themselves.
If other applications depend on this folder being on the Desktop, you could create a symbolic link with the "mklink" command. Since symbolic links are handled at the file system level (while shortcuts are actual files that simply point to another location), there should not be any compatibility issues with programs that try to use this type of "shortcut" in paths.
Yes, potentially limited by which version of Windows you have (Home versions may not have the ability to adjust ownership). Also, beware that removing your delete permissions is not a guarantee that you can't delete the folder. I've been burned multiple times.
Here is a method that is usually foolproof:
- Create a new user
- Assign ownership of the folder you don't want to be able to delete to this new user
- Remove your user's access to delete the folder, make sure your user has full read/write privileges in the folder.
I've used this trick on Windows NT to Windows 7. Sometimes you have to monkey around with the settings a bit before you get it perfect.
TEST THIS ON A NEW FOLDER FIRST (including creating files and folders within the test folder!
Also: Heed the advice of "Use Backups and version control". If the files are that important, you need at least 2 copies.
Windows file systems have a "read-only" flag. That is simpler than having to set DACL permissions for such a simple effect.
In a command prompt, use the ATTR command. In the GUI shell it should be in the Properties, though the gui might do something complex and beyond what you really wanted.
Also, if you re-create a directory with the same name you can then apply "restore previous versions" on it.
I experimented on a Win7 system. The GUI delete (without recycle bin) ignores the
R flag on the directory. There are no additional prompts warning about it, either, like I've seen for
S flags. Issuing
rd from the command line gives access denied as expected. However, you can't just
rd a non-empty directory anyway: delete file and remove directory are different commands. A command to recursively remove a directory with contents will remove the contents and than fail to remove the now-empty directory.
So protecting the directory itself doesn't work in the GUI action you have in mind. And it implies that any fancier approach to preventing the directory itself from being removed won't prevent it from being emptied first! You said you still want normal access within the directory to create and remove files, so locking it down completely is not a solution for you.
The best solution seems to be the symbolic link. Making a symbolic link (new style, what Windows Vista and above now call a symbolic link) to the directory on the desktop, when the directory actually exists somewhere else, works in the sense that if I delete the desktop icon (shift-delete, no recycle bin) the actual directory is unaffected as only the link was deleted.
Shift-Delete of the desktop icon did not care if it was marked with the
A program using the standard Windows file-open dialog box navigated through the symlink with no problems. It actually resolved the name of the linked directory, so the file opened was the real name; e.g.
D:\scratch\MyFolder as I navigated through it.
Using an old-style link (a Junction), the program saw the name with the junction still in the path; e.g.
C:\Users\john\Desktop\MyFolder\test.txt so the fact that it's a link is invisible. Yet, the GUI delete action still treated it as a link, not invisibly following it.
Either way, if a program does use the aliased name directly it will work. But having files sometimes seen with one name and sometimes the other could confuse things.
Use a Junction on the desktop with the folder really located elsewhere, and it will be completely transparent that this is what is happening. Optionally, using DACL to prevent accidental deleting of the junction point file on the desktop. At least, have a script to re-create it when needed.
I've not tried this, but I wonder if you could have something in "new items" to re-create the junction or symbolic link? Then just right-click on the now-empty desktop, choose New... and pick "Desktop Junk" from the menu. Have it restore everything you really did want on the desktop.
Another thing you might consider doing is enabling the File History feature of Windows 8.1. This will allow your system to automatically keep a history of changes to your files and folders. It's best to use with an external storage location, but could be used with a local drive as well.
An effective solution could be moving the folder out of the desktop and then setting up a NTFS junction using the
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
D:\ImportantFolder is the actual folder and
%userprofile%\Desktop\ImportantFolder is the junction.
- 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:\ImportantFolderand doing things. So if you delete a
passwords.txtfile in the junction, you have deleted it from
- 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.
You can backup all your files and folder in onedrive. You can use it free but limited for 15gb. However, if you have office 365 subscription you have 1TB storge in onedrive and it is included.
protected by Community♦ Jul 20 '16 at 21:03
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?