On deleting files from shared folder

Discussions about using Windows guests in VirtualBox.
Post Reply
asset
Posts: 5
Joined: 23. Jun 2012, 14:25

On deleting files from shared folder

Post by asset »

Hi there,

When I delete files from shared folder they are not first placed in recycle bin :(
Why is that? How to change so that they are first placed in recycle bin? :?:
Thanks in advance :)
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: On deleting files from shared folder

Post by mpack »

Well, you really ought to be asking Microsoft, rather than us, to explain their software decisions to you. However, I can give my off the cuff analysis.

I can think of two technical problems. (1) In Windows each drive has its own recycle folder (the desktop icon is just a summary), however with a shared folder Windows does not manage the drive and cannot allocate any hidden folders there, so the existing mechanism can't be used. (2) Normally a "deleted" file would simply be moved into the hidden recycle folder. However in the case of a file in a shared folder Windows would have to physically copy the file; for a large file this might create a large and mostly unnecessary network I/O overhead.
BillG
Volunteer
Posts: 5106
Joined: 19. Sep 2009, 04:44
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 10,7 and earlier
Location: Sydney, Australia

Re: On deleting files from shared folder

Post by BillG »

This sort of problem comes up pretty often in Microsoft networking forums. In Windows, a file is only moved to the recycle bin if it is deleted from the OS in the machine hosting the file. If you do the delete over the network from some other machine it is simply deleted, no recycle copy.
Bill
nhelder
Posts: 7
Joined: 30. Sep 2011, 18:22
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win2003, Win7, RHEL

Re: On deleting files from shared folder

Post by nhelder »

With regular Windows shares, there is a work-around for this:
You may have noticed that when you delete a file stored on a network location or mapped network drive that the file is permanently deleted. It does not go to the local computer's recycle bin and does not go to the server's recycle bin. I have discovered a work-around that extends recycle bin coverage to include mapped network drives. The solution is not 100% perfect, but works extremely well and does not rely on Shadow Copies or 3rd-party software.

Here's how:
1. Map a network drive to the network share you want to use. Make sure that the drive is re-connected on logon. If you don't know how to do this, search Google.
2. Browse to C:\users\<user name>.
3. Right-click on one of the folders in this location (I chose saved games) and click properties.
4. Select the Location tab.
5. Click Move, browse to to root of the drive you mapped in step 1, and click Select Folder.
6. Click Ok and click yes in the dialogue box that appears.
7. Repeat these same steps for all users on the computer.

You can now verify that the network drive is protected by the recycle bin by right-clicking on the recycle bin and clicking properties. The network drive should be listed in the Recycle Bin Locations column.

Some warnings:
1. This only protects files accessed through the mapped network drive, and not by UNC paths. So for example, if you mapped \\server\share to z:, and delete something off the z drive, it will go to the recycle bin. However, if you browse to \\server\share and delete a file, it will be deleted directly.
2. I don't know what will happen if your network drive is not available, so beware. This may not work well with laptops.
3. What ever files that were supposed to be stored in the folder you select in step 3 will now be stored on your mapped network drive by default. This can actually be quite useful.

Source: http://social.technet.microsoft.com/For ... 8b80c5dcb4
However, this trick does not seem to work with VirtualBox shared folders...

1) Create a shared folder, e.g. "Test", set it to automount and boot your VM (in my case, Windows 7 SP1)
2) As per the steps above, browse to your user's folder, right-click and select Properties > Location > Move and specify a location either at the root level of your VirtualBox share or a subfolder within that share and then click "Move"
3) Experience the following error: "Failed to build the list of known sub folders. The system cannot find the file specified."

It would be really slick of the above trick could be successfully applied to VirtualBox shares... does anyone have any idea what might be causing it to fail?

Thanks,

- Nathan
Post Reply