GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Ersatz Recycle Bin for USB drives and mapped network drives

These two buttons provide a replacement for the Windows Recycle Bin on USB flash drives and mapped network drives — the standard Windows Recycle Bin mostly does not work on such drives. I originally wrote them because VeraCrypt didn't delete to the Recycle Bin from mounted drives, but that turned out to be a temporary bug, now fixed, see [url]How to test whether a drive is a mounted drive?] .

Installation:
Download the two files, set DOpus to "Customise", and drag the files to a convenient toolbar or toolbar menu.

Configuration — The "Deletion" button:
The "Deletion" button will probably require three adjustments. Hold down the Alt key and RightClick on it — the text of the button will be displayed and the lines to be edited are clearly at the top of the file.

  1. THE "ForDeletion" DIRECTORY: There are two possibilities:
  • A "ForDeletion" directory may be created on each drive (omit the drive from the path for this option). With this option, the "ForDeletion" directory will have the same name and location on every drive, but it need not be on the root directory. OR
  • A single "ForDeletion" directory may be created for all drives (include a drive in the path for this option).
  1. MAXIMUM NUMBER OF DELETIONS: There is a safety limit of 100 items deleted at the one time. This can be edited.

  2. DRIVES THAT WILL USE THE WINDOWS RECYCLE BIN: Fixed drives should be able to use the Windows Recycle Bin already, so there is no real need for these buttons there. Edit the list of such drives, including C: drive. For these drives, the "Deletion" button will simply carry out the normal DOpus "Delete" command.

Configuration — The "Restoration" button:
The "Restoration" button also has a maximum number of restores, which can be changed from its default 100.

It is convenient to have a button to go to the "ForDeletion" directory. The command to so this when there is such a directory on each drive is "Go {SourcePath|}" .

Using the two buttons:
On any drive to which the buttons apply, select the files or directories to be deleted and press "Deletion". These items will removed to the "ForDeletion" directory. The date now is added to the name to prevent duplicates, then the date now, the date modified, and the original location, are stored in the "User Description" metadata field, then the item is given back its original date modified, then it is moved. To restore these items, go to the "ForDeletion" directory, select them and press the "Restoration" button. They will be restored to their original location with their original name and date modified.

It is useful to add the column "User Description" permanently to the columns of the "ForDeletion" directory. This can be done using the command "Properties FolderOptions", which is already a button in the standard DOpus Menu toolbar.

Restrictions and possibilities:

  1. The "ForDeletion" directory must be on an NTFS drive because data needs to be added to the User Description metadata field on deletion and read back on restoration. If a USB has been formatted FAT, then one would need to use a single "ForDeletion" directory on a fixed drive of the computer.

  2. Any USB will need to be given a fixed letter using Control Panel - - > System and Security - - > Administrative Tools - - > Create and Format Hard Disk Partitions (Disk Management), otherwise the drive letter may change at reboot or when the USB is inserted again. Similarly, network drive letters cannot change between deletion and restoration.

  3. A single "ForDeletion" directory may or may not be more convenient, but of course it would be completely insecure when being used for deletions from an encrypted drive.

  4. CCleaner allows user-defined directories, in this case the "ForDeletion" directories, to be added to its cleaning routine. If the "ForDeletion" folder is on a different drive, however, remnants of files may remain until chance overwriting occurs.

  5. It would not be hard to specify differently-named "ForDeletion" directories for certain drives and leave a default directory for the other drives, if that is needed.

  6. This system does not work on network drives that are not mapped to a drive letter. I could probably add that also if it is needed.

  7. There may be a better place in the metadata to store the file details. I chose the "User Description" rather than creating a new field.

As always, thanks to @leo and @tbone for advice and encouragement.

Version 1.1, 12/10/15:
Now applies to unmapped network drives + more flexibility + minor bug fix
See post below.
Deletion.dcf (40.4 KB) Restoration.dcf (8.65 KB)
Version 1.0, 09/10/15:
Deletion.dcf (15.1 KB) Restoration.dcf (8.2 KB)

1 Like

VERSION 1.1: UNMAPPED NETWORK DRIVES & FLEXIBILITY WITH "ForDeletion"

1. Unmapped network drives
I realised that with home networks, unmapped network drives are probably more important than mapped network drives. This version therefore applies to deletions of items such as \SpareRoomComputer\DriveD\Photos\2014\Photo26.jpg from unmapped network drives as well as to deletions from drives mapped to a letter.

2. Independent configuration of each drive
Independent configuration of each drive is desirable because:

  • With network drives, the "ForDeletion" directory is probably best placed on this computer.
  • With USB drives, the best place is probably that USB drive.
  • With mounted encrypted drives, a deletion location not on that drive is probably insecure.
  • With C: drive, one would usually want deletion to the normal Windows Recycle Bin.

This version 1.1 allows independent configuration of each drive. Setup is a little verbose, because a "ForDeletion" directory now needs to be specified for each letter. Such flexibility is not possible otherwise, however, and it easy to set up most drives in a common way. An empty path triggers the normal DOpus "Delete" function, which may or may not delete to the normal Windows Recycle Bin, depending on the computer's configuration.

This script configures all unmapped network drives the same way. Further parsing of the unmapped network drive paths could easily distinguish them.

Installation and configuration
Download both version 1.1 files, which have now been added to the original post, then drag them to your preferred toolbar location. Then edit the configuration lines at the top of each script. (A minor bug in version 1.0 has also been fixed.)

I fully rely on windows shadow copies/previous versions in the meantime and set up every system to create restore points automatically once a day on every connected drive/partition. This makes a great "Undo" from anywhere in the network, in case you mess things up. It requires the involved network drives to reside on windows machines though and won't work for USB connected storage.

Since then, I don't even need to fire up the backup machine to get back things I accidentally destroyed.
This may be a valid - but unknown - option for some as well, so.. o)

Hi Julianon - I'm just finding this little gem -- very nice!

Here's the next step I want to take with it. If you could give me some direction on modifying your script to do this, that'd be great -- or even better, you could write it yourself and save yours very lazily the effort!

After using the Duplicate File Finder on multiple mapped drives, from the results display I want to delete multiple files from different drives, with a single command -- and have each file sent to my "ersatz recycle bin" folder at the root of each mapped drive. I don't want to send all files to a single folder.

Of course I could sort them by drive and process them in chunks, but then I almost might as well just cut/paste them (except for your excellent Restore script).

I imagine I could do this in VBS, where I'm more comfortable, passing in a list of files and then calling a routine for each file ... but I fear the loop would be expensive, not to mention inelegant. Any thoughts?

Thanks much,
Bruce

bclemence, thanks for your kind remarks. I think that solving your problem is as easy as converting the two button-scripts to commands within an addin, which is very straightforward. I quickly created an addin that adds the command DeleteErstaz, which does exactly what the original button-script does. Creating a corresponding RestoreErsatz command within the same addin script will be just as easy.

From what you are saying, it would seem that with this addin installed, you would simply change every instance of your Delete command to DeleteErsatz.

Before I complete this and tidy everything up, could you confirm that I'm on the right track here --- I have never used the Duplicate File Finder, so I don't know what its procedures are. Actually, converting these two button-scripts to an addin is probably worth doing anyway, because I've found that writing and editing button scripts can be rather painful.