No description
Find a file
2016-10-21 23:58:59 -07:00
ci Fix unwrap on err in seance 2016-10-17 20:23:33 -07:00
src Update usage 2016-10-21 23:58:59 -07:00
.travis.yml Build for 64-bit osx 2016-10-18 00:09:18 -07:00
Cargo.toml Big improvements to resurrect, refactoring, code quality 2016-10-21 20:17:22 -07:00
LICENSE Add license 2016-09-17 22:56:23 -07:00
README.org Update usage 2016-10-21 23:58:59 -07:00

rip (Rm ImProved)

https://img.shields.io/crates/v/rm-improved.svg https://travis-ci.org/nivekuil/rip.svg?branch=master

rip is a command-line deletion tool focused on safety, ergonomics, and performance. It does not implement the xdg-trash spec.

Deleted files get sent to the graveyard (/tmp/.graveyard by default) under their absolute path, giving you a chance to recover them.

No data is overwritten. If files that share the same path are deleted, they will be renamed as numbered backups.

If you want to put the graveyard somewhere else (like ~/.local/share/Trash), you have two options, in order of precedence:

  1. Alias rip to rip --graveyard ~/.local/share/Trash
  2. Set the environment variable $GRAVEYARD to ~/.local/share/Trash

This can be a good idea because if the graveyard is mounted on an in-memory filesystem, (as /tmp is in Arch Linux), deleting large files can quickly fill up your RAM. It's also much slower to move files across filesystems, although the delay should be minimal with an SSD.

A deletion log is kept in the .record, found in the top level of the graveyard.

Installation

Get a binary release or run cargo install rm-improved with a nightly compiler.

Usage

USAGE:
    rip [FLAGS] [OPTIONS] [TARGET]...

FLAGS:
    -d, --decompose    Permanently deletes (unlink) the entire graveyard
    -h, --help         Prints help information
    -i, --inspect      Prints some info about TARGET before prompting for action
    -s, --seance       Prints files that were sent under the current directory
    -V, --version      Prints version information

OPTIONS:
        --graveyard <graveyard>    Directory where deleted files go to rest
    -r, --resurrect <target>       Undo the last removal by the current user, or specify some file(s) in the graveyard.  Combine with -s to restore everything printed by -s.

ARGS:
    <TARGET>...    File or directory to remove

Basic usage - same as rm

$ rip file1 hamilton/ dir1/

Print files that were deleted from under the current directory

$ rip -s
/tmp/.graveyard/home/jack/file1
/tmp/.graveyard/home/jack/dir1
/tmp/.graveyard/home/jack/hamilton

Restore the last deleted file

$ rip -r
Returned /tmp/.graveyard/home/jack/dir1 to /home/jack/dir1

Resolve name conflicts

$ touch file1
$ rip file1
$ rip -s
/tmp/.graveyard/home/jack/file1
/tmp/.graveyard/home/jack/hamilton
/tmp/.graveyard/home/jack/file1.1

-r also takes a file sent from current dir, or the absolute path of a file in the graveyard

$ rip -r file1
Returned /tmp/.graveyard/home/jack/file1.1 to /home/jack/file1

Combine -r and -s to restore everything printed by -s

$ rip -sr
Returned /tmp/.graveyard/home/jack/hamilto to /home/jack/hamilton
Returned /tmp/.graveyard/home/jack/file1 to /home/jack/file1.1

Notes

  • In general, a deletion followed by a --resurrect should be idempotent.
  • You probably shouldn't alias rm to rip. rm -r is two characters longer, anyway.