psubst icon indicating copy to clipboard operation
psubst copied to clipboard

Recycle bin feature

Open thesushil opened this issue 5 years ago • 6 comments

Please add a feature so that the files deleted from the virtual drive go into recycle bin. Thank you.

thesushil avatar Aug 03 '20 23:08 thesushil

It is hardly possible to implement the requested feature in easy way so to make it working automatically. I recommend you to do it manually following the steps as it's explained in this QA: https://superuser.com/questions/222747/recycle-bin-on-substed-drives.

ildar-shaimordanov avatar Aug 04 '20 13:08 ildar-shaimordanov

Please reopen this. Your objection is on the ground that it "only works for a single subst", while in reality this is only causes by a fixed GUID. A GUID can be trivially generated using PowerShell. If we don't have PS, we can even just use 123e4567-e89b-42d3-a456-1337950b57XY for all we care, where XY is the hexadecimal ASCII of the drive number and 950b57 is an awful encoding of psubst.

Artoria2e5 avatar Oct 07 '20 02:10 Artoria2e5

There are two issues already about the same thing: the issue #19 and this one.

Besides that there is stuff mentioned in https://github.com/ildar-shaimordanov/psubst/blob/master/TODO. I think the recycler is the tool you could like as the workaround to enable recycle bin for substed drives.

ildar-shaimordanov avatar Oct 07 '20 06:10 ildar-shaimordanov

The UUID thing I have solved with a new subroutine

:psubst_uuid
echo WScript.Echo Hex(Asc(WScript.Arguments(0))) > "%TEMP%\%~n0.hex.vbs"
for /f %%L in ('"%TEMP%\%~n0.hex.vbs" "!psubst_persist_disk!"') do set "uuid={123e4567-e89b-42d3-a456-1337950b57%%L}"
goto :EOF

But the elevated reg thing is starting to look awful as I must run multiple reg commands, so multiple sudo dances. Duh...

Artoria2e5 avatar Oct 07 '20 06:10 Artoria2e5

I see necessity in implementing this feature. However let's minimize any pollution to the main script. Enabling the recycle bin is not the main functionality of the psubst tool. It should be implemented as another tool turning on/off the recycle bin for SUBSTed drives.

ildar-shaimordanov avatar Oct 07 '20 06:10 ildar-shaimordanov

Enabling Recycle bin is not the main functionality of the Psubst tool. It should be implemented as another tool…

@ildar-shaimordanov, I disagree. Using Psubst is like plugging in another internal or external drive and Recycle bin is a property of any fixed drive on Windows OS that an average user expects to have out of the box. For example, if X: is mapped to C:\ and C:\ uses Recycle bin, then X: is expected to inherit that. It is an enlightened geeky admin who is aware of the current pitfalls, but an average user suffers, because one’s files, in case of deletion, are suddenly gone with no way to retrieve them back easily. To reduce the amount of suffering, Psubst should be improved. I don’t know how, since am not a developer, but you are (CV claims that).

sergeevabc avatar May 18 '21 09:05 sergeevabc