Releases: darrenklein/trash
Use binary search to look for duplicate names
It's probably overkill... but in the event that a user has a lot of items in their trash (or are attempting to trash
a lot of items... or both...), improve the efficiency of the script by using a binary search to determine whether or not an item with an identical name is already in the trash, or in the batch of items being trashed in an operation.
Install latest tag
In this release, I've added a small patch to the installation script that ensures that the user is installing the most recent tagged commit.
Duplicate item naming bugfix
This patch resolves two small bugs that were affecting the naming of duplicate item names in the same trash batch, and also slightly improves the efficiency and DRYness of the script.
Items that were unsuccessfully trashed were nonetheless being added to the batch of trashed_items
, meaning that they'd affect the naming conventions of any same-named items that followed - this has been resolved.
I was using the wrong variable to check for duplicates, which led to duplicate numbers being applied preemptively - was checking the original basename, rather than the updated item name - also, resolved.
The lowercased version of the final item name is already produced in the main execution block, no need to re-lowercase it at the end of handle_move
, just pass it as an argument instead.
Initial production release
I bet there's a lot of room for this script to grow and improve, but at this point, I feel confident that it works well enough to be considered ready for release.
I spent a lot of time covering edge cases, and I got everything that I could think of (note the emphasis) - duplicate file/dir names, capitalization issues, spacing issues... for my needs, this script works well, but I'm looking forward to seeing where it might go.
Resolve duplicate naming issue
Duplicate trashed item names were not being lowercased before checking for duplicates, resulting in occasional mis-numbering of these items. This release resolves the issue.
Initial release
This is the initial release of trash
, a bash script that allows users to move items to trash, rather than "hard" deleting them via the rm
and rmdir
commands.
This script aims to replicate the macOS naming behavior for duplicate files/dirs that have been moved to the trash, inserting/appending the current time as-needed.