Silently delete to recycle bin but warn if deleting on a network drive

Discuss and share scripts and script files...
Post Reply
xyply
Posts: 18
Joined: 18 Oct 2016 06:48

Silently delete to recycle bin but warn if deleting on a network drive

Post by xyply »

Hi guys,
does someone know how to script a sophisticated recycle bin behaviour for the scenario given below?

In case I delete something to the recycle bin, I would be able to recover it from there.
This is like in real life when I scrap a piece of paper in the dust bin.
In this case I do not want a delete confirmation

On the other hand there is no recycle bin when I delete something from a network share.
In this case I do want a confirmation request because there is no recovery option afterwards.
This is like burning a document which makes me think more thoroughly before I do it.

With the sophisticated behaviour I always know that I must pay attention if a confirmation dialog appears.
This prevents to get trained to click OK by habit.

highend
Posts: 13317
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Silently delete to recycle bin but warn if deleting on a network drive

Post by highend »

Tomorrow evening, if someone else doesn't do first...
One of my scripts helped you out? Please donate via Paypal

highend
Posts: 13317
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Silently delete to recycle bin but warn if deleting on a network drive

Post by highend »

Code: Select all

    $items = get("SelectedItemsPathNames", "|");
    if (!$items) { status "No item(s) to delete, aborted!", "8B4513", "stop"; end true; }
    if (regexmatches($items, "\\\\")) {
        if (confirm("Really delete item(s) in network path?", , 1, 4)) { delete 0, 0, $items; }
    } else { delete 1, 0, $items; }
Don't forget that XY has a few options about informing the user about a delete, like:
Configuration | Menus, Mouse, Safety | Safety Belts | Confirm delete operations
Configuration | Undo & Action Log | Prompt before delete
Configuration | File Operations | Miscellaneous | Suppress delete confirmation dialog
One of my scripts helped you out? Please donate via Paypal

xyply
Posts: 18
Joined: 18 Oct 2016 06:48

Re: Silently delete to recycle bin but warn if deleting on a network drive

Post by xyply »

Thanks a lot.
I thought it would be possible.
Also thanks for the hints about the delete confirmations.
I knew about those but I either can go to the risky side, when I disable the confirmation.
Or I get many confirmation request which are safe (because they go to the recycle bin)
This makes me less aware when I am on a network drive where files really get deleted.
I think users should be trained to be aware of the special case and not be trained to click OK to delete confirmations.

Post Reply