使用Network Recycle Bin啟用映射網(wǎng)絡(luò)驅(qū)動(dòng)器上的回收站

前言

在內(nèi)網(wǎng)環(huán)境中我們經(jīng)常會(huì)使用NAS或者Samba在Windows中映射網(wǎng)絡(luò)驅(qū)動(dòng)器,方便局域網(wǎng)用戶實(shí)時(shí)共享交換數(shù)據(jù)。但當(dāng)存儲(chǔ)在網(wǎng)絡(luò)或映射網(wǎng)絡(luò)上的任何文件被刪除時(shí),該文件將被永久刪除。它不會(huì)去到本地計(jì)算機(jī)回收站,也不會(huì)去到服務(wù)器的回收站,我通過google在mydigitallife和microsoft technet中搜索到很多方法,但針對(duì)不同操作系統(tǒng)且涉及到域用戶管理的復(fù)雜情況下,單純的依賴注冊(cè)表修改可能已經(jīng)支撐不住需求的膨脹了。在所有的方法中使用Network Recycle Bin可以輕松解決映射網(wǎng)絡(luò)驅(qū)動(dòng)器上的回收站。

使用Network Recycle Bin為局域網(wǎng)巧設(shè)“回收站”

更新歷史

2018年04月20日 - 初稿

閱讀原文 - https://wsgzao.github.io/post/network-recycle-bin/

擴(kuò)展閱讀

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


如何啟用映射網(wǎng)絡(luò)驅(qū)動(dòng)器上的回收站

映射驅(qū)動(dòng)器不過是將本地驅(qū)動(dòng)器連接到另一臺(tái)計(jì)算機(jī)上特別分配的共享目錄或文件夾。 一旦驅(qū)動(dòng)器被映射,您就可以訪問共享資源,您可以像對(duì)待您的系統(tǒng)本地一樣對(duì)待它??梢詫⒍鄠€(gè)計(jì)算機(jī)驅(qū)動(dòng)器映射到共享資源,并利用此網(wǎng)絡(luò)空間。

當(dāng)存儲(chǔ)在網(wǎng)絡(luò)或映射網(wǎng)絡(luò)上的任何文件被刪除時(shí),該文件將被永久刪除。 它不會(huì)去到本地計(jì)算機(jī)回收站,也不會(huì)去到服務(wù)器的回收站。 為了避免將來出現(xiàn)這種數(shù)據(jù)丟失情況,您可以在映射的網(wǎng)絡(luò)驅(qū)動(dòng)器上啟用回收站。 按照以下給出的步驟在映射的網(wǎng)絡(luò)驅(qū)動(dòng)器上啟用回收站.

  1. 將網(wǎng)絡(luò)驅(qū)動(dòng)器映射到要使用的網(wǎng)絡(luò)共享。 確保登錄后重新連接驅(qū)動(dòng)器
  2. 然后進(jìn)入C:> 用戶 > 用戶名
  3. 右鍵單擊該位置的任何文件夾,然后單擊 屬性 > 位置選項(xiàng)卡
  4. 單擊移動(dòng)并瀏覽根驅(qū)動(dòng)器(在步驟1中映射),然后點(diǎn)擊選擇文件夾
  5. 然后點(diǎn)擊 好 并當(dāng)對(duì)話框出現(xiàn)命中 是
  6. 只需在PC上為每個(gè)用戶重復(fù)這些步驟

注意:要驗(yàn)證此過程是否正常工作,請(qǐng)右鍵單擊回收站并轉(zhuǎn)至屬性,并檢查網(wǎng)絡(luò)驅(qū)動(dòng)器是否在回收站的位置列中列出。

image

image

需要注意的事情

這僅適用于通過映射的網(wǎng)絡(luò)驅(qū)動(dòng)器而不是UNC路徑訪問的文件。 我們舉一個(gè)例子:如果你已經(jīng)將\server\share映射到E:并從這個(gè)E:驅(qū)動(dòng)器中刪除了一些東西,那么它將會(huì)進(jìn)入回收站。 但是,如果您瀏覽到\server\share并擦除文件,它將被永久刪除。

Enable Recycle Bin on mapped network drives

方案1,通過重定向文件位置的方式我自己在Windows 10下測(cè)試可用,但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,通過修改注冊(cè)表搞定回收站問題,實(shí)際測(cè)試喜憂參半,通用性不高,不推薦

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簡(jiǎn)介

本文主要使用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使用方法

使用方法非常簡(jiǎn)單,安裝好Network Recycle Bin Tool只需要4步即可,其它需求可以自定義Options

  1. 選擇Protect Folders添加你需要保護(hù)的的映射網(wǎng)絡(luò)驅(qū)動(dòng)器
  2. Options中確認(rèn)刪除文件的存儲(chǔ)路徑,默認(rèn)可以不修改
  3. 在映射網(wǎng)絡(luò)驅(qū)動(dòng)器中嘗試刪除測(cè)試文件,在Deleted Files可以看到刪除的文件
  4. 可以批量選中要恢復(fù)或者刪除的文件點(diǎn)擊Recovery Files或者Delete Files
image

image

image
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi閱讀 7,854評(píng)論 0 10
  • PLEASE READ THE FOLLOWING APPLE DEVELOPER PROGRAM LICENSE...
    念念不忘的閱讀 13,660評(píng)論 5 6
  • 關(guān)于那些天災(zāi)人禍,當(dāng)我們只是以旁觀者看待時(shí),總是不以為然,匆匆一瞥,認(rèn)為離自己很遙遠(yuǎn)。但是真正發(fā)生在身邊時(shí),會(huì)令你...
    安之_道閱讀 217評(píng)論 0 0
  • 8月11日,樂視體育聯(lián)手Leie和飛鴿集團(tuán)聯(lián)手打造的首款智能硬件:樂視超級(jí)自行車正式發(fā)布,同時(shí)也發(fā)布了樂視體育智能...
    f11015f29d83閱讀 221評(píng)論 0 2
  • 一起從寫字樓出來 好女人回家 淘米做飯 翻看存折 計(jì)劃開銷 對(duì)明天具體的幸福 懷有簡(jiǎn)單的憧憬 一起從寫字樓出來 壞...
    行走的卓瑪閱讀 137評(píng)論 0 0

友情鏈接更多精彩內(nèi)容