Sustainable digital trash immutable archive

Keep files forever — with audit-grade context.

stash replaces destructive deletion with an immutable “trash/archive” workflow: move or copy files into a permanent my_trash folder, stamp the filename with date + machine, and attach rich metadata via extended attributes (xattrs). Encrypted variants (estash/ecopy) support file-level encryption.

Designed for researchers, developers, and sysadmins who want non-destructive cleanup, recoverability, and provenance over time.

Features

Minimal, composable, and transparent.

Non-destructive removal

Move (stash) or copy (copy) into a permanent my_trash directory instead of deleting.

Stamped filenames

Renames using YYYYMMDD-HHMM-USER@MACHINE to preserve context and enable sorting without a database.

Audit-friendly metadata

Writes xattrs like action, date, machine, username, and working directory (pwd) for provenance and forensics.

Encrypted variants

estash / ecopy support file-level encryption (uses “rage” in the repo tooling).

Plays well with real storage

Recommended: send files to an SD card VeraCrypt container. A cloud-synced folder can also work (with xattr caveats).

Small enough to trust

A few scripts you can read end-to-end, customize, and keep close to your workflow.

How it works

A new “state of trash”: sustainable digital trash.

File naming format

When you stash/copy a file, it’s renamed like this:

YYYYMMDD-HHMM-USERNAME@MACHINE   original_filename

Example:
20250406-1613-dd@Nix25Think   hej_tester_archive_command

The prefix gives you chronological sorting and “where did this come from?” at a glance.

Behavior by command

Four commands, two core actions, plus encryption:

stash   → moves file to my_trash + annotates
copy    → copies file to my_trash + annotates
estash  → encrypts + moves to my_trash + annotates
ecopy   → encrypts + copies to my_trash + annotates

Metadata is stored as xattrs so your archive can remain filesystem-native (no index required).

Install

Keep it simple: clone + put scripts on PATH.

Option A — clone and run

Quick start for local use:

git clone https://github.com/taext/stash.git
cd stash

# Try it from the repo folder (adjust to your setup)
./stash some_file.txt

Tip: you’ll likely want to configure where my_trash lives (e.g., SD/VeraCrypt mount).

Option B — copy to a bin folder

Install scripts somewhere on your PATH (example):

# Example: personal bin
mkdir -p ~/.local/bin

# Copy scripts you want (names depend on your repo layout)
cp stash copy estash ecopy ~/.local/bin/
chmod +x ~/.local/bin/stash ~/.local/bin/copy ~/.local/bin/estash ~/.local/bin/ecopy

# Ensure ~/.local/bin is on PATH (shell-dependent)
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
Note: xattrs and preservation behavior can vary across filesystems and sync tools.

If you rely on metadata, prefer native Unix-like filesystems (ext4/APFS/XFS) and test your sync pipeline.

Usage

Replace “rm” with a reversible habit.

Basic examples

# Move a file into the permanent archive
stash hej_notes.txt

# Copy a file into the permanent archive
copy results.csv

After running, the file appears in my_trash with a prefixed timestamp/machine label.

Encrypted variants

# Encrypt + move
estash secrets.txt

# Encrypt + copy
ecopy dataset.parquet

Use when your archive target is removable media or a shared/synced location.

Metadata (xattrs)

Rich provenance without a database.

Inspect metadata

View extended attributes using:

# macOS / BSD-ish:
ls -@ "20250406-1613-dd@Nix25Think   hej_tester_archive_command"

# Linux:
getfattr -d "20250406-1613-dd@Nix25Think   hej_tester_archive_command" 2>/dev/null || true

# Generic:
xattr -l "filename"

Typical attributes

Common keys written by the scripts:

user.action   = "stash" | "copy"
user.date     = "localized timestamp"
user.machine  = "hostname"
user.pwd      = "working directory at execution"
user.username = "invoking user"
Practical note:

Some cloud sync tools and cross-filesystem moves can drop xattrs. If metadata is critical, prefer a workflow that keeps files on xattr-friendly filesystems end-to-end.

Security & encryption

Choose the threat model you actually have.

Filesystem-first

Plain stash/copy are ideal for local or encrypted-at-rest destinations (e.g., a mounted VeraCrypt container).

File-level encryption

Use estash/ecopy when the archive lives on removable media or synced storage.

Operational clarity

Keep restoration simple: you’re archiving files, not inventing a custom store. Prefer readable, reversible processes.

Where this shines

Use cases that benefit from “trash as archive”.

Ideal for

  • Research workflows where provenance matters months later
  • Sysadmin cleanup where “oops” should be reversible
  • Developer contexts where “delete later” is common
  • Incident response / debugging where evidence preservation matters

Principle

If storage is cheap, context is expensive.

stash treats deletion as a logged archival event—capturing who/when/where—so you can recover, audit, and reinterpret files as your work evolves.