使用Network Recycle Bin启用映射网络驱动器上的回收站

前言

在内网环境中我们经常会使用NAS或者Samba在Windows中映射网络驱动器,方便局域网用户实时共享交换数据。但当存储在网络或映射网络上的任何文件被删除时,该文件将被永久删除。它不会去到本地计算机回收站,也不会去到服务器的回收站,我通过google在mydigitallife和microsoft technet中搜索到很多方法,但针对不同操作系统且涉及到域用户管理的复杂情况下,单纯的依赖注册表修改可能已经支撑不住需求的膨胀了。在所有的方法中使用Network Recycle Bin可以轻松解决映射网络驱动器上的回收站。

使用Network Recycle Bin为局域网巧设“回收站”

更新历史

2018年04月20日 - 初稿

阅读原文 - https://wsgzao.github.io/post/network-recycle-bin/

扩展阅读

Network Recycle Bin Tool - http://www.networkrecyclebin.info/index.html


如何启用映射网络驱动器上的回收站

映射驱动器不过是将本地驱动器连接到另一台计算机上特别分配的共享目录或文件夹。 一旦驱动器被映射,您就可以访问共享资源,您可以像对待您的系统本地一样对待它。可以将多个计算机驱动器映射到共享资源,并利用此网络空间。

当存储在网络或映射网络上的任何文件被删除时,该文件将被永久删除。 它不会去到本地计算机回收站,也不会去到服务器的回收站。 为了避免将来出现这种数据丢失情况,您可以在映射的网络驱动器上启用回收站。 按照以下给出的步骤在映射的网络驱动器上启用回收站.

  1. 将网络驱动器映射到要使用的网络共享。 确保登录后重新连接驱动器
  2. 然后进入C:> 用户 > 用户名
  3. 右键单击该位置的任何文件夹,然后单击 属性 > 位置选项卡
  4. 单击移动并浏览根驱动器(在步骤1中映射),然后点击选择文件夹
  5. 然后点击 好 并当对话框出现命中 是
  6. 只需在PC上为每个用户重复这些步骤

注意:要验证此过程是否正常工作,请右键单击回收站并转至属性,并检查网络驱动器是否在回收站的位置列中列出。

image

image

需要注意的事情

这仅适用于通过映射的网络驱动器而不是UNC路径访问的文件。 我们举一个例子:如果你已经将\server\share映射到E:并从这个E:驱动器中删除了一些东西,那么它将会进入回收站。 但是,如果您浏览到\server\share并擦除文件,它将被永久删除。

Enable Recycle Bin on mapped network drives

方案1,通过重定向文件位置的方式我自己在Windows 10下测试可用,但Windows 7失败了

https://forums.mydigitallife.net/threads/tip-network-recycle-bin.16974/

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.

image

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.

方案2,通过修改注册表搞定回收站问题,实际测试喜忧参半,通用性不高,不推荐

https://social.technet.microsoft.com/Forums/windows/en-US/a349801f-398f-4139-8e8b-b0a92f599e2b/enable-recycle-bin-on-mapped-network-drives

Just copy and paste the following into notepad
and save it as "Network Recycling Bin - auto make registry file.bat"

echo off 
REM ========== MAIN FUNCTION  ======================== 
  
Call :CreateREGfile 
PAUSE 
goto :eof 
  
  
  
  
REM ========== SUB FUNCTIONS  ======================== 
  
:CreateREGfile 
set /p RelativePath=Enter current mapped path of drive (e.g. X:\FileShare\D_Drive): 
REM replace \ with \\ (for reg value its a requirement) 
Set RelativePath=%RelativePath:\=\\%  
  
  
set /p MaxBinSize_Dec=Enter max size (in mb) (eg 11gb=11000): 
call :toHex %MaxBinSize_Dec% MaxBinSize_Hex 
  
  
Set outputREG="Network Recycling Bin - %RelativePath:~0,1% Drive (%MaxBinSize_Dec%mb).reg" 
  
  
call :MakeGUID_VBS NewGUID 
REM echo My new GUID : %NewGUID% 
  
  
echo Windows Registry Editor Version 5.00 > %outputREG% 
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\%NewGUID%] >> %outputREG% 
echo "RelativePath"="%RelativePath%" >> %outputREG% 
echo "Category"=dword:00000004 >> %outputREG% 
echo "Name"="NetworkDrive2RecyclingBin_%NewGUID:~1,5%" >> %outputREG% 
      REM The "Name" value is required, but is not the name that will be shown if you right-click on the Recycle Bin and select properties. That will be autoset to the network drive name. 
echo.>> %outputREG% 
echo [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\BitBucket\KnownFolder\%NewGUID%]  >> %outputREG% 
echo "MaxCapacity"=dword:%MaxBinSize_Hex% >> %outputREG% 
echo "NukeOnDelete"=dword:00000000 >> %outputREG% 
goto :eof 
  
  
  
:MakeGUID_VBS 
echo set obj = CreateObject("Scriptlet.TypeLib") > TEMP_generateGUID.vbs 
echo WScript.Echo obj.GUID >> TEMP_generateGUID.vbs 
FOR /F "usebackq tokens=*" %%rin (`CSCRIPT "TEMP_generateGUID.vbs"`)DO SET RESULT=%%r 
set %1=%RESULT% 
  
del TEMP_generateGUID.vbs 
goto :eof 
  
  
:toDec 
:: todec hex dec -- convert a hexadecimal number to decimal 
::             -- hex [in]      - hexadecimal number to convert 
::             -- dec [out,opt] - variable to store the converted decimal number in 
SETLOCAL 
set /a dec=0x%~1 
( ENDLOCAL & REM RETURN VALUES 
    IF "%~2" NEQ "" (SET %~2=%dec%)ELSE ECHO.%dec% 
) 
EXIT /b 
  
  
:toHex 
:: eg  call :toHex dec hex -- convert a decimal number to hexadecimal, i.e. -20 to FFFFFFEC or 26 to 0000001A 
::             -- dec [in]      - decimal number to convert 
::             -- hex [out,opt] - variable to store the converted hexadecimal number in 
::Thanks to 'dbenham' dostips forum users who inspired to improve this function 
:$created 20091203 :$changed 20110330 :$categories Arithmetic,Encoding 
:$source http://www.dostips.com 
SETLOCAL ENABLEDELAYEDEXPANSION 
set /a dec=%~1 
set "hex=" 
set "map=0123456789ABCDEF" 
for /L %%Nin (1,1,8)do ( 
    set /a "d=dec&15,dec>>=4" 
    for %%Din (!d!)do set "hex=!map:~%%D,1!!hex!" 
) 
rem !!!! REMOVE LEADING ZEROS by activating the next line, e.g. will return 1A instead of 0000001A 
rem for /f "tokens=* delims=0" %%A in ("%hex%") do set "hex=%%A"&if not defined hex set "hex=0" 
( ENDLOCAL & REM RETURN VALUES 
    IF "%~2" NEQ "" (SET %~2=%hex%)ELSE ECHO.%hex% 
) 
EXIT /b 
  
  
:eof

Network Recycle Bin Tool简介

本文主要使用Network Recycle Bin Tool Personal Client Machine Edition客户端

Server Edition

version 6.1.1.3

This version has been designed for the server usage. You should install it on the server to monitor shared folders. When network user will delete a shared file it will copy it to the "network recycle bin". You have not install any additional software on client machines.

Personal Client Machine Edition

version 5.2.3.8

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.

How to enable a recycle bin for shared folders on a network ? There is the proper solution of restoring and securing your information even after deleting it - The Network Recycle Bin Tool allows you to recover deleted files.

Once you have this tool in your system, it will automatically keep a track of all the network deleted files and you can easily recover them. Instead of removing the files, this tool sends them directly to its predefined recycle bin folder.

There are various options to tune it up. For example: you can set size limits for files stored in the Network Recycle Bin, you can define the list of network drives or network folders to track deleted files.

Additionaly it offers you the Protect Files tool which prevents deletion of network files for specified folders according the file mask. Export and import functions help you to install software with same options on network machines. The password control disallows unauthorized access.

In the long run, losing your important network files and information accidentally is not an issue these days. Instead of getting anxious and worried, feel free to download network recycle bin tool from any reliable source and make sure that you have pre-installed this recovery tool.

Network Recycle Bin Tool使用方法

使用方法非常简单,安装好Network Recycle Bin Tool只需要4步即可,其它需求可以自定义Options

  1. 选择Protect Folders添加你需要保护的的映射网络驱动器
  2. Options中确认删除文件的存储路径,默认可以不修改
  3. 在映射网络驱动器中尝试删除测试文件,在Deleted Files可以看到删除的文件
  4. 可以批量选中要恢复或者删除的文件点击Recovery Files或者Delete Files
image

image

image
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 158,847评论 4 362
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 67,208评论 1 292
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 108,587评论 0 243
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 43,942评论 0 205
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 52,332评论 3 287
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,587评论 1 218
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,853评论 2 312
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,568评论 0 198
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,273评论 1 242
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,542评论 2 246
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 32,033评论 1 260
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,373评论 2 253
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 33,031评论 3 236
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,073评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,830评论 0 195
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,628评论 2 274
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,537评论 2 269

推荐阅读更多精彩内容