[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why @#! is not Emacs using the Recycle bin on w32?
From: |
Werner LEMBERG |
Subject: |
Re: Why @#! is not Emacs using the Recycle bin on w32? |
Date: |
Sat, 30 Aug 2008 20:37:55 +0200 (CEST) |
> > I use the `libtrash' library very successfully to prevent
> > accidental data loss (since I mainly work on the console which
> > never uses the trash folder of the GUI).
>
> Sounds interesting. At what level does it interface?
At the lowest one. Here some snippets of the README:
libtrash is a shared library which, when preloaded, will intercept
calls to a series of GNU libc functions and make sure that, if an
attempt to destroy certain files is made, these won't be permanently
destroyed but rather moved to a "trash can". It also allows the
user to mark certain directories as "unremovable", which means that
calls to functions which would result in the loss of files under
these directories will always fail, leaving those files untouched in
their original locations.
(This last feature is meant as a higher-level substitute for ext2fs'
"immutable" flag for use by those of us who rely on other file
systems. An important difference is that libtrash allows
non-privileged users to use this with their personal files.)
The GNU libc functions which can be overriden/"wrapped" are
- unlink() / unlinkat();
- rename() / renameat();
- fopen() / fopen64();
- freopen() / freopen64();
- open() / openat() / open64() / openat64().
You can individually enable / disable each of these "protections";
by default, only calls to the first two functions are intercepted.
[...]
libtrash recreates the directory structure of your home directory
under the trash can, which means that, should you need to recover
the mistakenly deleted file /home/user/programming/test.c, it will
be stored in /home/user/Trash/programming/test.c. If you have
instructed libtrash to also store copies of files which you delete
in directories outside of your home dir (see libtrash.conf for
details), they will be available under Trash/SYSTEM_ROOT. E.g.:
after deletion by the user joe, /common-dir/doc.txt will be
available at /home/joe/Trash/SYSTEM_ROOT/common-dir/doc.txt.
I have a cron job which simply deletes files in the `Trash' directory
older than 24 hours (using a script which comes with the libtrash
library).
Werner
Re: Why @#! is not Emacs using the Recycle bin on w32?, Phil Jackson, 2008/08/29
Re: Why @#! is not Emacs using the Recycle bin on w32?, Johannes Weiner, 2008/08/29