ildar-shaimordanov / psubst

Associates a path with a drive letter and extends the standard SUBST command allowing to create persistent substituted drives between startups
MIT License
170 stars 40 forks source link

Recycle bin feature #18

Open thesushil opened 4 years ago

thesushil commented 4 years ago

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

ildar-shaimordanov commented 4 years ago

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.

Artoria2e5 commented 3 years ago

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.

ildar-shaimordanov commented 3 years ago

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.

Artoria2e5 commented 3 years ago

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...

ildar-shaimordanov commented 3 years ago

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.

sergeevabc commented 3 years ago

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).