Giter VIP home page Giter VIP logo

trash-cli's Introduction

trash-cli - Command Line Interface to FreeDesktop.org Trash.

Downloads

Donate

简体中文

trash-cli trashes files recording the original path, deletion date, and permissions. It uses the same trashcan used by KDE, GNOME, and XFCE, but you can invoke it from the command line (and scripts).

It provides these commands:

trash-put           trash files and directories.
trash-empty         empty the trashcan(s).
trash-list          list trashed files.
trash-restore       restore a trashed file.
trash-rm            remove individual files from the trashcan.

Usage

Trash a file:

$ trash-put foo

List trashed files:

$ trash-list
2008-06-01 10:30:48 /home/andrea/bar
2008-06-02 21:50:41 /home/andrea/bar
2008-06-23 21:50:49 /home/andrea/foo

Search for a file in the trashcan:

$ trash-list | grep foo
2007-08-30 12:36:00 /home/andrea/foo
2007-08-30 12:39:41 /home/andrea/foo

Restore a trashed file:

$ trash-restore
0 2007-08-30 12:36:00 /home/andrea/foo
1 2007-08-30 12:39:41 /home/andrea/bar
2 2007-08-30 12:39:41 /home/andrea/bar2
3 2007-08-30 12:39:41 /home/andrea/foo2
4 2007-08-30 12:39:41 /home/andrea/foo
What file to restore [0..4]: 4
$ ls foo
foo

Restore a trashed file while overwriting existing files:

$ echo "original">foo
$ ls
foo
$ trash foo
$ echo "new">foo
$ trash-restore --overwrite
0 2022-11-01 22:15:00 /home/andrea/foo
What file to restore [0..0]: 0
$ cat foo
original

Restore multiple trashed files separated by ',', also support range:

$ trash-restore
0 2007-08-30 12:36:00 /home/andrea/foo
1 2007-08-30 12:39:41 /home/andrea/bar
2 2007-08-30 12:39:41 /home/andrea/bar2
3 2007-08-30 12:39:41 /home/andrea/foo2
What file to restore [0..3]: 0-2, 3
$ ls foo bar bar2 foo2
foo bar bar2 foo2

Remove all files from the trashcan:

$ trash-empty

Remove only the files that have been deleted more than <days> ago:

$ trash-empty <days>

Example:

$ date
Tue Feb 19 20:26:52 CET 2008
$ trash-list
2008-02-19 20:11:34 /home/einar/today
2008-02-18 20:11:34 /home/einar/yesterday
2008-02-10 20:11:34 /home/einar/last_week
$ trash-empty 7
$ trash-list
2008-02-19 20:11:34 /home/einar/today
2008-02-18 20:11:34 /home/einar/yesterday
$ trash-empty 1
$ trash-list
2008-02-19 20:11:34 /home/einar/today

Remove only files matching a pattern:

$ trash-rm \*.o

Note: you need to use quotes in order to protect the pattern from shell expansion.

FAQ

How to create a top level .Trash dir?

Steps

sudo mkdir --parent /.Trash
sudo chmod a+rw /.Trash
sudo chmod +t /.Trash

Can I alias rm to trash-put?

You can but you shouldn't. In the early days I thought it was a good idea to do that but now I changed my mind.

Although the interface of trash-put seems to be compatible with rm, it has different semantics which will cause you problems. For example, while rm requires -R for deleting directories trash-put does not.

But sometimes I forget to use trash-put, really can't I?

You could alias rm to something that will remind you to not use it:

alias rm='echo "This is not the command you are looking for."; false'

Then, if you really want to use rm, simply prepend a backslash to bypass the alias:

\rm file-without-hope

Note that Bash aliases are used only in interactive shells, so using this alias should not interfere with scripts that expect to use rm.

Where the trashed files go?

File trashed from the home partition will be moved here:

~/.local/share/Trash/

How to auto delete files older that 30 days?

Run this:

(crontab -l ; echo "@daily $(which trash-empty) 30") | crontab -

This will update your crontab file with a trash-empty command that runs daily and removes files older than 30 days. To review your crontab use: crontab -l

Installation

The easy way

Requirements:
  • Python 3 (Python 2.7 also work)
  • pipx (optional, to install in a clean environment)

If pipx is available:

pipx install trash-cli

Alternatively, install with vanilla pip:

pip install trash-cli

Note: you may want add ~/.local/bin to the PATH:

echo 'export PATH="$PATH":~/.local/bin' >> ~/.bashrc
source ~/.bashrc # reload .bashrc

For uninstalling use:

pipx uninstall trash-cli

or:

pip uninstall trash-cli

Bleeding Edge (from sources)

First of all you need to uninstall any previous version of trash-cli:

$ [sudo] pip uninstall trash-cli # remove the previous version (with pip)
$ [sudo] apt-get remove trash-cli # remove the previous version (with apt)
$ [sudo] yum uninstall trash-cli # remove the previous version (with yum)
$ ... # refer to the package manager of your distribution

Then install the latest version from git:

$ [sudo] pip install git+https://github.com/andreafrancia/trash-cli

After the user installation you may want add this line to your .bashrc/.zshrc:

export PATH=~/.local/bin:"$PATH"

From package manager

Debian/Ubuntu (apt):

sudo apt install trash-cli

Arch Linux (pacman):

sudo pacman -S trash-cli

Fedora (dnf):

sudo dnf install trash-cli

Install shell completions

You need install by:

pipx install 'trash-cli[completion]'

or:

pip install 'trash-cli[completion]'

Then:

cmds=(trash-empty trash-list trash-restore trash-put trash)
for cmd in ${cmds[@]}; do
  $cmd --print-completion bash | sudo tee /usr/share/bash-completion/completions/$cmd
  $cmd --print-completion zsh | sudo tee /usr/share/zsh/site-functions/_$cmd
  $cmd --print-completion tcsh | sudo tee /etc/profile.d/$cmd.completion.csh
done

Bugs

If you discover a bug please report it here:

https://github.com/andreafrancia/trash-cli/issues

Feedback

You can send me an email using [email protected].

Development

Environment setup:

python -m venv .venv
source .venv/bin/activate
pip install -r requirements-dev.txt -r requirements.txt

Running tests:

pytest -m 'not slow'        # run only fast tests
pytest -m 'slow'            # run slow tests
pytest                      # run all tests

Thanks

Thanks to Paypal donors.

Thanks to project contributors.

Thanks to JetBrains for their license for Open Source Development

trash-cli's People

Contributors

a1346054 avatar andreafrancia avatar ari3s avatar bryango avatar cosinekitty avatar cyrusyip avatar dreua avatar freed-wu avatar jackenmen avatar joeljpa avatar jonpas avatar ksr-yasuda avatar laggardkernel avatar lucagiove avatar lukasvrenner avatar masgouri avatar matt-london avatar nbeaver avatar olajep avatar qadzek avatar self-perfection avatar siddhant avatar soraxas avatar stefano-k avatar stefanor avatar waldyrious avatar yssmcl avatar ytoku avatar yurigo79 avatar zpuskas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

trash-cli's Issues

trash-empty should ask for confirmation

when i do trash-empty it instantly empties the trash.

instead of doing this, it should ask, "Are you sure?".

you may add -f option which will NOT ask that question.

please implement this.

thank you

Cannot trash file if home directory is on different volume

OS: Ubuntu 10.04

In my setup, my home directory is actually an NFS mount on a fileserver. On attempting to run "trash-put" on a file stored on my hard drive, I get the following error:

Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/libtrash/__init__.py", line 266, inpersist_trash_info
    os.makedirs(self.getInfoPath(), 0700)
  File "/usr/lib/python2.6/os.py", line 150, in makedirs
    makedirs(head, mode)
  File "/usr/lib/python2.6/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/.Trash-1577'
trash: cannot trash `test': [Errno 13] Permission denied: '/.Trash-1577'

Is there anything I can do about this?

I have made a new partition on a secondary drive, owned by my main user. I can use trash-put, but trash-empty does not remove the files.

The drive is mounted to /mnt/blue , and I see /mnt/blue/.Trash/files and /mnt/blue/.Trash/info have been created. I see all of the files in there, but trash-empty doesn't clear them. I'm guessing this has something to do with permissions and ownership. Any ideas of how to fix this?

Thanks for the great program, by the way! I use it with ranger instead or rm, and it's been wonderful!

trash-empty => OSError: [Errno 22] Invalid argument: '/home/elijah/.local/share/Trash/files/.'

$ trash-empty
Traceback (most recent call last):
  File "/usr/local/bin/trash-empty", line 5, in <module>
    pkg_resources.run_script('trash-cli==0.12.9.14-r0', 'trash-empty')
  File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 517, in run_script
    for ep in entries.values():
  File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 1443, in run_script
    path = self.module_path
  File "/usr/local/lib/python2.7/dist-packages/trash_cli-0.12.9.14_r0-py2.7.egg/EGG-INFO/scr
ipts/trash-empty", line 5, in <module>
    pkg_resources.run_script('trash-cli==0.12.9.14-r0', 'trash-empty')
  File "build/bdist.linux-x86_64/egg/trashcli/cmds.py", line 31, in empty
  File "build/bdist.linux-x86_64/egg/trashcli/trash.py", line 937, in run
  File "build/bdist.linux-x86_64/egg/trashcli/trash.py", line 806, in __call__
  File "build/bdist.linux-x86_64/egg/trashcli/trash.py", line 963, in _empty_all_trashdirs
  File "build/bdist.linux-x86_64/egg/trashcli/trash.py", line 879, in list_trashdirs
  File "build/bdist.linux-x86_64/egg/trashcli/trash.py", line 884, in emit_home_trashcan
  File "build/bdist.linux-x86_64/egg/trashcli/trash.py", line 238, in path_to
  File "build/bdist.linux-x86_64/egg/trashcli/trash.py", line 883, in return_result_with_vol
ume
  File "build/bdist.linux-x86_64/egg/trashcli/trash.py", line 978, in _analize_trash_directo
ry
  File "build/bdist.linux-x86_64/egg/trashcli/trash.py", line 1087, in each_trashinfo
  File "build/bdist.linux-x86_64/egg/trashcli/trash.py", line 856, in delete_if_expired
  File "build/bdist.linux-x86_64/egg/trashcli/trash.py", line 866, in _delete_unconditionall
y
  File "build/bdist.linux-x86_64/egg/trashcli/trash.py", line 839, in delete_trashinfo_and_b
ackup_copy
  File "build/bdist.linux-x86_64/egg/trashcli/fs.py", line 27, in remove_file_if_exists
  File "build/bdist.linux-x86_64/egg/trashcli/fs.py", line 25, in remove_file
  File "/usr/lib/python2.7/shutil.py", line 256, in rmtree
    onerror(os.rmdir, path, sys.exc_info())
  File "/usr/lib/python2.7/shutil.py", line 254, in rmtree
    os.rmdir(path)
OSError: [Errno 22] Invalid argument: '/home/elijah/.local/share/Trash/files/.'

Problem trashing with verbose option

Se uso trash-put con l'opzione "verbose", il tuo script mi da un errore relativo a file non esistente e lamenta di non poterlo cestinare:

trash-put -v prova.txt

trash-put: Failed to trash prova.txt in /media/array/.Trash/0, because :topdir should be a directory: /media/array/.Trash/0
trash-put: `prova.txt' trashed in /media/array/.Trash-0

Se, però, poi analizzo il cestino, quel file sembrerebbe esser stato correttamente cestinato:

trash-list | grep prova.txt

2013-05-06 14:34:22 /media/array/tmp/prova.txt

il file non è più infatti nella posizione ove si trovava:

ls prova.txt

ls: impossibile accedere a prova.txt: File o directory non esistente

Se non si specifica l'opzione --verbose non si ha nessun messaggio d'errore.

Sembra legato ad un uso da una parte di ~/.Trash-0 e dall'altra ~/.Trash/0 (che non esiste).

Man-page points to a wrong website

Hi!

A true story :-) :

A `trash-put 0.12.7` user had to report a bug and he executed `man trash` (or `man trash-list` or `man trash-empty`, etc.) and he saw: 

    Report bugs to http://code.google.com/p/trash-cli/issues

then he created a Google account, etc. just to see later that... he had to go to another place, and do the same in the other place.

Solution:

The man-pages should say instead

    Report bugs to https://github.com/andreafrancia/trash-cli/issues

Those bugs should be easy to solve :-)

Thanks for the good trash-cli software! Keep up the good work!

Cannot install trash-cli on SuSE Linux Enterprise Server 10

I wanted to install trash-cli from source on server which runs SuSE Linux Enterpise Server 10 (64b). I got the following error:

# python setup.py install
Traceback (most recent call last):
  File "setup.py", line 3, in ?
    from distutils.core import setup
ImportError: No module named distutils.core

I'm using python 2.4.2.

trash-put returns 0 even if the file could not be "deleted" in a correct way

Hi!

trash-put 0.12.7 returns 0 even if the file could not be "deleted" in a correct way. For example:

$ trash-put /INEXISTENT_FILE; echo $?
trash-put: cannot trash non existent `/INEXISTENT_FILE'
0

and that forbids developments like

trash-put "$file" || manage_error

However:

$ rm /INEXISTENT_FILE; echo $?
rm: /INEXISTENT_FILE: No such file or directory
1

and that allows developments like

rm "$file" || manage_error

In other words:
If trash-put finds a problem deleting a file, it should not return 0 because it has found an error.

If trash-put returned "1" in the prior example, as rm does, it should be an advantage, as it allows a better rm replacement, and it follows better the standards.

I suppose that it should be easy to solve :-)

Anyway, thanks for the good trash-cli software! Keep up the good work!

trash remove non existing files on a mounted windows share, trash process hangs

Hi,
I noticed something:
When using trash command on a linux local partition in some directory:

trash non existent file extensions:

like: trash *.obj

I get: trash: cannot trash non existent `*.obj'

But doing this on a mounted share (samba) used cifs mount command for a windows share.
If even one file exists everything is ok if I do try to trashing non existing files
like: trash *.obj
this hangs - I have to do a keyboard interrupt
^CTraceback (most recent call last):
File "/opt/anaconda2.3.0/bin/trash", line 4, in
import('pkg_resources').run_script('trash-cli==0.12.9.14.post0', 'trash')
File "/opt/anaconda2.3.0/lib/python2.7/site-packages/setuptools-17.1.1-py2.7.egg/pkg_resources/init.py", line 735, in run_script
File "/opt/anaconda2.3.0/lib/python2.7/site-packages/setuptools-17.1.1-py2.7.egg/pkg_resources/init.py", line 1659, in run_script
File "/opt/anaconda2.3.0/lib/python2.7/site-packages/trash_cli-0.12.9.14.post0-py2.7.egg/EGG-INFO/scripts/trash", line 5, in

File "build/bdist.linux-x86_64/egg/trashcli/cmds.py", line 10, in put
File "build/bdist.linux-x86_64/egg/trashcli/trash.py", line 548, in run
File "build/bdist.linux-x86_64/egg/trashcli/trash.py", line 557, in trash_all
File "build/bdist.linux-x86_64/egg/trashcli/trash.py", line 560, in trash
File "build/bdist.linux-x86_64/egg/trashcli/trash.py", line 324, in trash
File "build/bdist.linux-x86_64/egg/trashcli/trash.py", line 71, in trash
File "build/bdist.linux-x86_64/egg/trashcli/trash.py", line 191, in persist_trash_info
KeyboardInterrupt

I replicated this issue on two different environments with permanent mounts. Same thing every time.
Also tried it with versions trash 0.12.9.14 and 0.12.7 on Ubuntu1404 x64
Best

Cannot trash files on the *same* partition as the trash

I'm going to open a new issue so it doesn't get lost. This was originally posted in issue #13 (comment)

I understand that trash-cli cannot trash files when the trash and the file are on seperate partitions. However, I'm now running into the opposite of this. I have my trash on HDD, and my home on SDD. This time, I can only trash files that are on the SDD, and not those on the HDD (the same partition as the trash). As you can see below, I can trash okay if I specify a semi-absolute path, or a relative path in some cases. However, it fails if I specify the totally absolute path (without symlinks, see below). Also see the end for a workaround script.

$ mount
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sys on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
dev on /dev type devtmpfs (rw,nosuid,relatime,size=8162056k,nr_inodes=2040514,mode=755)
run on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755)
/dev/sdb7 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=22,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
mqueue on /dev/mqueue type mqueue (rw,relatime)
configfs on /sys/kernel/config type configfs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
tmpfs on /tmp type tmpfs (rw)
/dev/sdb8 on /home type ext4 (rw,relatime,data=ordered)
/dev/sda2 on /HDD type ext4 (rw,relatime,data=ordered)
/dev/sda2 on /var/cache type ext4 (rw,relatime,data=ordered)
/dev/sda2 on /var/log type ext4 (rw,relatime,data=ordered)
/dev/sda2 on /var/tmp type ext4 (rw,relatime,data=ordered)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=1632972k,mode=700,uid=1000,gid=1000)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime)
$ ls -lad /
drwxr-xr-x 18 root root 4096 Jun  5 01:22 /
$ ls -lad /home
drwxr-xr-x 5 root root 4096 May 21 15:31 /home
$ ls -lad /home/protist
drwxr-x--- 115 protist protist 4096 Jun  5 16:52 /home/protist
$ ls -lad /home/protist/HDD
drwxr-x--- 10 protist protist 4096 Jun  5 16:53 /home/protist/HDD  -> /HDD/protist
$ ls -lad /home/protist/.local/share/Trash
lrwxrwxrwx 1 protist protist 49 Jun  5 17:04 /home/protist/.local/share/Trash -> /HDD/protist/.SDDsymlinks/home/protist/.local/share/Trash

$ cd ~
$ touch foo
$ trash foo # works for files on a different partition.
$ cd ~/HDD
$ touch foo
$ trash foo # fails for files on the same partition.
trash: cannot trash regular empty file `foo'
$ trash ./foo # fails for this format
trash: cannot trash regular empty file `./foo'
$ trash ~/HDD/foo # works if I specify relative to home directory, with "semi-absolute" path.
$ touch foo
$ cd ..
$ trash HDD/foo # works again for this relative path.
$ cd ~/HDD
$ touch foo
$ readlink -e foo
/HDD/protist/foo
$ trash /HDD/protist/foo # fails again for totally absolute path without symlinks.
trash: cannot trash regular empty file `/HDD/protist/foo'

I've worked around this by defining a trash wrapper in my $PATH, ahead of /usr/bin/trash. This works well, and now allows trashing of all files, no matter what partition they are on! I've put this in /usr/local/bin/trash

#!/usr/bin/env bash
# Workaround for trash-cli not being able to trash files on the *same* partition.

for i in "$@"; do
  fullpath="$(readlink -e "$i")"
  fixedpath="$(echo "$fullpath" | sed "s,/HDD/$USER,$HOME/HDD,")"
  /usr/bin/trash "$fixedpath"
done

implement -i for trash-put

trash-put allows the -i flag for gnu rm compatibility, however, it's silently ignored.

It would be useful to actually support interactive moving to the trash.

Cannot trash regular file

trash-put gives this error when I try to trash a file /blah/some-non-home-path/foobar:

trash-put: cannot trash regular file `foobar'

For files which do not have $HOME as their parent directory, can trash-put be modified to use $HOME always to find the Trash directory?

Configure trash folders

Hi,

trash-cli is a great tool, but something bothers me. I have my / and my /home on different partitions. trash-cli correctly handles the partitions, i.e if I delete a file, it will put it in the directory .Trash on this partition.

But unfortunetaly, Nemo for instance puts the deleted files in a .Trash-1000. So, is there a way to tell trash-cli how it should name the trash folder ?

Thanks

Matching full path in trash-rm

Is it possible to add support for full path matching in trash-rm?
If not, do you have a workaround for that use case?

Thanks!

Support ranges in restore-trash

When restoring files, it would be nice if restore-trash supported a range of files to restore. Like this:

(saucy)andreas@incubator:~$ restore-trash
0 2013-08-02 12:50:39 /home/andreas/temp/2
1 2013-08-02 12:52:50 /home/andreas/temp/4
2 2013-08-02 12:52:50 /home/andreas/temp/3
3 2013-08-02 12:50:39 /home/andreas/temp/1
What file to restore [0..3]: 1-3

Now the files 1,2 and 3 would be restored. Instead, restore-trash crashes:

Traceback (most recent call last):
File "/usr/bin/restore-trash", line 9, in
load_entry_point('trash-cli==0.12.7', 'console_scripts', 'restore-trash')()
File "/usr/lib/python2.7/dist-packages/trashcli/cmds.py", line 20, in restore
input = raw_input
File "/usr/lib/python2.7/dist-packages/trashcli/trash.py", line 547, in run
index = int(index)
ValueError: invalid literal for int() with base 10: '1-3'
(saucy)andreas@incubator:~$

Issue with permanent deletion?

I've been using trashcli for some time. I just ran the following

trash .*

which came up with the error message:

trash: cannot trash `.': [Errno 22] Invalid argument: '.'

and then hit Ctrl+C a second later as I wasn't sure what the effect would be. The files that were in the directory have been deleted, but they were not moved to trash. I'm not sure if this is a bug or not, but thought you might be interested. Had the following readout :

trash: cannot trash `.': [Errno 22] Invalid argument: '.'
^CTraceback (most recent call last):
File "/usr/bin/trash", line 143, in
trash(f)
File "/usr/bin/trash", line 46, in trash
trashed_file = TrashDirectory.getHomeTrashDirectory().trash(f)
File "/usr/lib/pymodules/python2.6/libtrash/init.py", line 194, in trash
fileToBeTrashed.move(self.getOriginalCopyPath(trash_id))
File "/usr/lib/pymodules/python2.6/libtrash/init.py", line 67, in move
return shutil.move(self.path, str(dest))
File "/usr/lib/python2.6/shutil.py", line 257, in move
copytree(src, real_dst, symlinks=True)
File "/usr/lib/python2.6/shutil.py", line 154, in copytree
copytree(srcname, dstname, symlinks, ignore)
File "/usr/lib/python2.6/shutil.py", line 154, in copytree
copytree(srcname, dstname, symlinks, ignore)
File "/usr/lib/python2.6/shutil.py", line 154, in copytree
copytree(srcname, dstname, symlinks, ignore)
File "/usr/lib/python2.6/shutil.py", line 154, in copytree
copytree(srcname, dstname, symlinks, ignore)
File "/usr/lib/python2.6/shutil.py", line 154, in copytree
copytree(srcname, dstname, symlinks, ignore)
File "/usr/lib/python2.6/shutil.py", line 156, in copytree
copy2(srcname, dstname)
File "/usr/lib/python2.6/shutil.py", line 95, in copy2
copyfile(src, dst)
File "/usr/lib/python2.6/shutil.py", line 52, in copyfile
copyfileobj(fsrc, fdst)
File "/usr/lib/python2.6/shutil.py", line 28, in copyfileobj
buf = fsrc.read(length)
KeyboardInterrupt

Ubuntu 10.10, Bash 4.1.5(1)

Integration test fails

I prepared the development environment in Fedora 22 according to the documentation. The unit test passes, but the integration test fails:

(env)[jberan@dhcp-24-186 trash-cli2]$ nosetests integration_tests
.F.......SS......................................................................
======================================================================
FAIL: integration_tests.describe_trash_list.describe_trash_list.should_output_info_for_multiple_files
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jberan/git/trash-cli2/env/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/jberan/git/trash-cli2/integration_tests/describe_trash_list.py", line 76, in should_output_info_for_multiple_files
    self.user.should_read_output( "2000-01-01 00:00:01 /file1\n"
  File "/home/jberan/git/trash-cli2/integration_tests/describe_trash_list.py", line 296, in should_read_output
    self.stdout.assert_equal_to(expected_value)
  File "/home/jberan/git/trash-cli2/integration_tests/output_collector.py", line 11, in assert_equal_to
    return self.should_be(expected)
  File "/home/jberan/git/trash-cli2/integration_tests/output_collector.py", line 13, in should_be
    assert_equals_with_unidiff(expected, self.stream.getvalue())
  File "/home/jberan/git/trash-cli2/integration_tests/assert_equals_with_unidiff.py", line 19, in assert_equals_with_unidiff
    unidiff(expected, actual))
AssertionError: 
Expected:'2000-01-01 00:00:01 /file1\n2000-01-01 00:00:02 /file2\n2000-01-01 00:00:03 /file3\n'
  Actual:'2000-01-01 00:00:03 /file3\n2000-01-01 00:00:02 /file2\n2000-01-01 00:00:01 /file1\n'
--- Expected
+++ Actual
@@ -1,3 +1,3 @@
+2000-01-01 00:00:03 /file3
+2000-01-01 00:00:02 /file2
 2000-01-01 00:00:01 /file1
-2000-01-01 00:00:02 /file2
-2000-01-01 00:00:03 /file3


----------------------------------------------------------------------
Ran 81 tests in 0.282s

FAILED (SKIP=2, failures=1)

trash-put deferences symlinks

touch orig
ln -s orig link
trash-put link

Expected behaviour is to trash the symlink. Instead, trash-put deletes the target (orig), leaving a dangling symlink.

trash-empty crashes with directories without read permission

If a file does not have write permissions, trash-empty crashes.

$ trash-empty 7
Traceback (most recent call last):
  File "/usr/bin/trash-empty", line 5, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/site-packages/trashcli/cmds.py", line 23, in empty
    ).run(*sys.argv)
  File "/usr/lib/python2.7/site-packages/trashcli/trash.py", line 446, in run
    parse(argv)
  File "/usr/lib/python2.7/site-packages/trashcli/trash.py", line 315, in __call__
    self.default_action()
  File "/usr/lib/python2.7/site-packages/trashcli/trash.py", line 466, in _empty_all_trashdirs
    self.trashdirs.list_trashdirs()
  File "/usr/lib/python2.7/site-packages/trashcli/trash.py", line 388, in list_trashdirs
    self.emit_home_trashcan()
  File "/usr/lib/python2.7/site-packages/trashcli/trash.py", line 393, in emit_home_trashcan
    self.home_trashcan.path_to(return_result_with_volume)
  File "/usr/lib/python2.7/site-packages/trashcli/trash.py", line 83, in path_to
    out('%(HOME)s/.local/share/Trash' % self.environ)
  File "/usr/lib/python2.7/site-packages/trashcli/trash.py", line 392, in return_result_with_volume
    self.on_trash_dir_found(trashcan_path, '/')
  File "/usr/lib/python2.7/site-packages/trashcli/trash.py", line 481, in _analize_trash_directory
    self.trashdir.each_trashinfo(self.on_trashinfo_found)
  File "/usr/lib/python2.7/site-packages/trashcli/trash.py", line 573, in each_trashinfo
    action(os.path.join(self._info_dir(), entry))
  File "/usr/lib/python2.7/site-packages/trashcli/trash.py", line 365, in delete_if_expired
    self._maybe_delete(trashinfo_path)
  File "/usr/lib/python2.7/site-packages/trashcli/trash.py", line 373, in _delete_according_date
    )(contents)
  File "/usr/lib/python2.7/site-packages/trashcli/trash.py", line 629, in __call__
    self.found_deletion_date(date)
  File "/usr/lib/python2.7/site-packages/trashcli/trash.py", line 490, in __call__
    self.then()
  File "/usr/lib/python2.7/site-packages/trashcli/trash.py", line 371, in <lambda>
    lambda: self._delete_unconditionally(trashinfo_path)
  File "/usr/lib/python2.7/site-packages/trashcli/trash.py", line 375, in _delete_unconditionally
    self._trashcan.delete_trashinfo_and_backup_copy(trashinfo_path)
  File "/usr/lib/python2.7/site-packages/trashcli/trash.py", line 348, in delete_trashinfo_and_backup_copy
    self._file_remover.remove_file_if_exists(backup_copy)
  File "/usr/lib/python2.7/site-packages/trashcli/fs.py", line 27, in remove_file_if_exists
    if os.path.exists(path): self.remove_file(path)
  File "/usr/lib/python2.7/site-packages/trashcli/fs.py", line 25, in remove_file
    shutil.rmtree(path)
  File "/usr/lib/python2.7/shutil.py", line 247, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "/usr/lib/python2.7/shutil.py", line 239, in rmtree
    onerror(os.listdir, path, sys.exc_info())
  File "/usr/lib/python2.7/shutil.py", line 237, in rmtree
    names = os.listdir(path)
OSError: [Errno 13] Permission denied: '/home/protist/.local/share/Trash/files/jitsi/pkg'
$ ls -ld /home/protist/.local/share/Trash/files/jitsi/pkg
d--------- 2 protist protist 4096 Feb  9 09:49 /home/protist/.local/share/Trash/files/jitsi/pkg

N.B. this is owned by me, and so trash-empty can change its permissions.

$ chmod u+wrx /home/protist/.local/share/Trash/files/jitsi/pkg
$ trash-empty

This works. (N.B. that u+wx is not enough.)

trash-restore not found

Installed at beginning of the week and could have sworn I saw trash-restore, went to go use it and "command not found". Tried reinstalling the Python way and no go. Should I reinstall?

trash-empty fails if there is a dir in the trash

I can consistently reproduce this with most recent version from git.

$ git log -n1 --pretty=oneline
5fb33334b14e1fa29be68fa58f06f70c07190583 Fix commands
$ ./bin/trash-list 
2012-03-22 11:57:46 /home/andrew/Desktop/foobar
$ ./bin/trash-empty 
Traceback (most recent call last):
  File "./bin/trash-empty", line 9, in <module>
    load_entry_point('trash-cli==0.11.3', 'console_scripts', 'trash-empty')()
  File "/home/andrew/Desktop/trash-cli/install/lib/python2.7/site-packages/trash_cli-0.11.3-py2.7.egg/trashcli/cmds.py", line 29, in empty
    ).run(*sys.argv)
  File "/home/andrew/Desktop/trash-cli/install/lib/python2.7/site-packages/trash_cli-0.11.3-py2.7.egg/trashcli/trash.py", line 945, in run
    parse(argv)
  File "/home/andrew/Desktop/trash-cli/install/lib/python2.7/site-packages/trash_cli-0.11.3-py2.7.egg/trashcli/trash.py", line 894, in __call__
    self.default_action()
  File "/home/andrew/Desktop/trash-cli/install/lib/python2.7/site-packages/trash_cli-0.11.3-py2.7.egg/trashcli/trash.py", line 963, in _empty_all_trashdirs
    self.trashdirs.for_each_trashdir_and_volume(self._empty_trashdir)
  File "/home/andrew/Desktop/trash-cli/install/lib/python2.7/site-packages/trash_cli-0.11.3-py2.7.egg/trashcli/trash.py", line 1064, in for_each_trashdir_and_volume
    self._for_home_trashcan_info_dir_path(action)
  File "/home/andrew/Desktop/trash-cli/install/lib/python2.7/site-packages/trash_cli-0.11.3-py2.7.egg/trashcli/trash.py", line 1069, in _for_home_trashcan_info_dir_path
    home_trashcan_if_possible(self.environ, return_result_with_volume)
  File "/home/andrew/Desktop/trash-cli/install/lib/python2.7/site-packages/trash_cli-0.11.3-py2.7.egg/trashcli/trash.py", line 1083, in home_trashcan_if_possible
    action('%(HOME)s/.local/share/Trash' % environ)
  File "/home/andrew/Desktop/trash-cli/install/lib/python2.7/site-packages/trash_cli-0.11.3-py2.7.egg/trashcli/trash.py", line 1068, in return_result_with_volume
    action(trashcan_path, '/')
  File "/home/andrew/Desktop/trash-cli/install/lib/python2.7/site-packages/trash_cli-0.11.3-py2.7.egg/trashcli/trash.py", line 967, in _empty_trashdir
    trashdir.each_trashinfo(self._maybe_delete)
  File "/home/andrew/Desktop/trash-cli/install/lib/python2.7/site-packages/trash_cli-0.11.3-py2.7.egg/trashcli/trash.py", line 1111, in each_trashinfo
    action(os.path.join(self._info_dir(), entry))
  File "/home/andrew/Desktop/trash-cli/install/lib/python2.7/site-packages/trash_cli-0.11.3-py2.7.egg/trashcli/trash.py", line 982, in _delete_both
    self.file_remover.remove_file_if_exists(backup_copy)
  File "/home/andrew/Desktop/trash-cli/install/lib/python2.7/site-packages/trash_cli-0.11.3-py2.7.egg/trashcli/trash.py", line 785, in remove_file_if_exists
    if os.path.exists(path): self.remove_file(path)
  File "/home/andrew/Desktop/trash-cli/install/lib/python2.7/site-packages/trash_cli-0.11.3-py2.7.egg/trashcli/trash.py", line 783, in remove_file
    return os.remove(path)
OSError: [Errno 21] Is a directory: '/home/andrew/.local/share/Trash/files/foobar'
$ ./bin/trash-list 
2012-03-22 11:57:46 /home/andrew/Desktop/foobar````

Crash/Stacktrace when selecting a value out of range in restore-trash

When entering a value of of range, restore-trash crashes:

(saucy)andreas@incubator:~$ restore-trash
0 2013-08-02 12:50:39 /home/andreas/temp/2
1 2013-08-02 12:50:39 /home/andreas/temp/1
What file to restore [0..1]: 2
Traceback (most recent call last):
File "/usr/bin/restore-trash", line 9, in
load_entry_point('trash-cli==0.12.7', 'console_scripts', 'restore-trash')()
File "/usr/lib/python2.7/dist-packages/trashcli/cmds.py", line 20, in restore
input = raw_input
File "/usr/lib/python2.7/dist-packages/trashcli/trash.py", line 549, in run
trashed_files[index].restore()
IndexError: list index out of range

restore-crash should check the user input, give an error and go back to the selection screen when the value entered is invalid.

Problem using Trash on a usb key

When using rm on a usb key and after typing trash-list I got this error:

TrashDir skipped because parent not sticky: /backup/.Trash/1000
TrashDir skipped because parent not sticky: /mnt/usbkey/disk2go2/.Trash/1000

Segfault in all trash-cli commands (crash)

Recently I upgraded python to 2.7.10 and noticed that all trash-cli commands abort with segfault.
I tried to fix the problem and found that libc.getmntent(f) in list_mount_points.py::_mounted_filesystems_from_getmnt() is the point.

With some experiments, I could fix the problem by adding the following two lines,

--- a/trashcli/list_mount_points.py     2015-06-16 22:07:28.911957504 +0900
+++ b/trashcli/list_mount_points.py     2015-06-16 22:08:36.777137116 +0900
@@ -56,7 +56,9 @@

     libc = cdll.LoadLibrary(libc_name)
     libc.getmntent.restype = POINTER(mntent_struct)
+    libc.getmntent.argtypes = [c_void_p]
     libc.fopen.restype = c_void_p
+    libc.fclose.argtypes = [c_void_p]

     f = libc.fopen("/proc/mounts", "r")
     if f==None:

although I'm not sure if this is a right way to fix it.

Parse Error While Trash-list

After using "trash-list" in Ubuntu12.10, it shows "Parse Error: /home/***/.local/share/Trash/info/Applications.2.trashinfo: Unable to parse Path".
And then it can show what is trashed.

Cannot trash file in /tmp

With trash-put 0.11.3 packaged for Kubuntu 12.04, I am unable to trash-put a regular or empty file in /tmp.

When I run with --verbose on an empty file, I get this message:

trash-put: Failed to trash emptyfile in /.Trash/1000, because :topdir should be a directory: /.Trash/1000
trash-put: Failed to trash emptyfile in /.Trash-1000, because :[Errno 13] Permission denied: '/.Trash-1000'
trash-put: cannot trash regular empty file `emptyfile'

I have not tried this yet with the latest version and wanted to know if this sort of problem has already been fixed before I install the new version.

Man pages problem (easy installer).

Hi! :-)

I installed here (at Kubuntu 12.10 x64), the last trash version with "easy installation" (after installing python setup tools).
All the binaries installed correctly, but it missed the man pages.

Workarround: I grub the man pages from sources, I zipped and copied them to the man1 directory.

PS. If ti isn't a bug of the easy installer, but it's a feature instead, then I'm doing the suggestion to include the man pages to the installer.

THANKS!!! :-)

0.12.4 not installable via easy_install/pip

This is the output from easy_install. Similar output (ez_setup not found) from pip. A former installation with 0.11.3 worked.

$ easy_install --user trash-cli
Searching for trash-cli
Reading http://pypi.python.org/simple/trash-cli/
Reading https://github.com/andreafrancia/trash-cli
Reading http://code.google.com/p/trash-cli
Reading http://code.google.com/p/trash-cli/wiki/Download
Best match: trash-cli 0.12.4
Downloading http://pypi.python.org/packages/source/t/trash-cli/trash-cli-0.12.4.tar.gz#md5=283fb53fa28854fac85beee769f6994c
Processing trash-cli-0.12.4.tar.gz
Running trash-cli-0.12.4/setup.py -q bdist_egg --dist-dir /tmp/easy_install-JDXffA/trash-cli-0.12.4/egg-dist-tmp-v04K_F
Traceback (most recent call last):
  File "/usr/bin/easy_install", line 9, in <module>
    load_entry_point('distribute==0.6.24dev-r0', 'console_scripts', 'easy_install')()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1931, in main
    with_ei_usage(lambda:
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1912, in with_ei_usage
    return f()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1935, in <lambda>
    distclass=DistributionWithoutHelpCommands, **kw
  File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 368, in run
    self.easy_install(spec, not self.no_deps)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 608, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 638, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 828, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1105, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1094, in run_setup
    run_setup(setup_script, args)
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 30, in run_setup
    lambda: execfile(
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 72, in run
    return func()
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 32, in <lambda>
    {'__file__':setup_script, '__name__':'__main__'}
  File "setup.py", line 3, in <module>
ImportError: No module named ez_setup

trash-cli creates a new .Trash directory also a ~/.local/share/Trash exists

In the / directory I have a link
home -> /mnt/store/home

If I use trash, the ~/.local/share/Trash is not used but rather a new trash directory is created at /mnt/store/.Trash/500
However trash-list seems to look at ~/.local/share/Trash

Furthermore it complains about sticky bits. Why trash-cli is not correcting the rights? at least for directories which are created.

Overall, a very useful command line trash.

Best regards,
Octavian

Problems with trash and partitions

I've got an SSD and (spindle) HDD, and several partitions on my computer. The SDD contains / and /home, and the HDD contains /home/protist/HDD (via fstab). The HDD also contains /home/protist/.local/share/Trash via symlinks. I can trash files perfectly if they reside within /home/protist/HDD, but cannot trash files that are directly in /home/protist.

$ touch ~/temp
$ trash ~/temp 
trash: cannot trash regular empty file `temp'

I've tried creating directories at /.Trash and ~/.Trash, but that did not help.

More safety Tips / Suggestions

This is not really a bug but a TIP. (zsh related). I do not know where else can I put it.

Just sharing a few line code (zsh only) which others may be in search for. (because I searched too and finally made one on my own)

Purpose:

  1. trash / trash-put should ask before trashing, just like rm -i
  2. trash-put should not trash directory but just a regular file
  3. trash-empty and trash-rm should ask first. Infact ask twice, because its going to be erased forever! (Intention is to be 100% sure!)
  4. If user uses rm instead of trash-put, ask first before running rm

Here is the code: (put in your .zshrc)

if (( $+commands[trash-put] )); then
  rm() {
    if read -q "?$0: are you sure you do NOT want to use trash-put? [N/y] "; then
        echo ""
        nocorrect command rm -i "$@"
    fi
  }
  trash-put() {
    local file;
    for file in "$@"; do
      if [[ ! -f $file ]]; then
          echo "$0: cannot remove '$file': not a regular file"
          continue
      fi
      if read -q "?$0: trash regular file '$file'? [N/y] "; then
        echo ""
        nocorrect command trash-put -v -- $file
      fi
    done
  }
  alias trash=trash-put
fi
if (( $+commands[trash-rm] )); then
  trash-rm() {
    if read -q "?$0: are you sure you want to use trash-rm? [N/y] "; then
      echo ""
      if read -q "?$0: are you REALLY sure you want to use trash-rm? [N/y] "; then
          echo ""
          nocorrect command trash-rm "$@"
      fi
    fi
  }
fi
if (( $+commands[trash-empty] )); then
  trash-empty() {
    if read -q "?$0: are you sure you want to empty trash? [N/y] "; then
      echo ""
      if read -q "?$0: are you REALLY sure you want to empty trash? [N/y] "; then
          echo ""
          nocorrect command trash-empty "$@"
      fi
    fi
  }
fi

Hope it helps!

trash-empty not working for partitions

I have several mounted partitions in /media/. They each have their own .Trash folder

du -shc /media/*/.Trash*
    5.5M    /media/d/.Trash
trash-empty
du -shc /media/*/.Trash*
    5.5M    /media/d/.Trash

As can be seen above trash-empty will in any case (couldn't find options and current working dir also didn't seem to matter) only empty ~/.local/share/Trash and not .Trash on my mounted partitons. I found this very unexpected, I would have thought trash-empty clears all trashs like nemo and Thunar would do.

That's something i want to do about root's permission file, i thought someone mybe need it

trash-cli is nice for me. but that's something bother me. so i create a new command trash-recover for me.
It really doesn't necessarily have to need it, but i need it and maybe someone need it too.

I work at platform ubuntu

Bother me: trigger error 'cannot trash regular file' when trash-put [file]

trash-put root's file must do it with 'sudo trash-put', if not, it will trigger this error,
and put the trash.info files to Trash Hub with the current user permission, and the root's file
you want to trash still in there.

Here is the command link trash-recover

Import warning

trash-put works fine, but prints the following warning:
/usr/bin/trash-put:5: UserWarning: Module dap was already imported from None, but /usr/lib/python2.7/dist-packages is being added to sys.path
from pkg_resources import load_entry_point

Allow "trash-restore $path"

... easier than having to scroll through a long list of paths.
Another option would be at least to sort the restorable paths.

trash-restore all/multiple files

I just accidentally trashed my massive downloads folder; I had all the files in the folder selected within ranger, and tried to delete a single file, forgetting they were all selected.

Derp.

So, I got everything back, but I had to $ trash-restore 0 200 times, manually.

It would be really nice to have a method of restoring multiple files at once, or perhaps just an option to restore ALL files at once. in case something like this happens.

request: list of available options for commands

I see man pages in trash-cli/man/man1/, but these are not coming up when I enter man trash-rm, etc.
I am on Mac OS 10.9.5 and installed trash-cli via Git clone and Python 2.7 set-up. Below is the tail of the install-script output:

running install_data
creating /System/Library/Frameworks/Python.framework/Versions/2.7/share
creating /System/Library/Frameworks/Python.framework/Versions/2.7/share/man
creating /System/Library/Frameworks/Python.framework/Versions/2.7/share/man/man1
copying man/man1/trash-empty.1 -> /System/Library/Frameworks/Python.framework/Versions/2.7/share/man/man1
copying man/man1/trash-list.1 -> /System/Library/Frameworks/Python.framework/Versions/2.7/share/man/man1
copying man/man1/trash-restore.1 -> /System/Library/Frameworks/Python.framework/Versions/2.7/share/man/man1
copying man/man1/trash-put.1 -> /System/Library/Frameworks/Python.framework/Versions/2.7/share/man/man1
copying man/man1/trash-rm.1 -> /System/Library/Frameworks/Python.framework/Versions/2.7/share/man/man1
running install_egg_info
Writing /Library/Python/2.7/site-packages/trash_cli-0.12.10.3_-py2.7.egg-info

Change trash folder to user home

How can I change the trash folder from /Home/.Trash to /home/user/.Trash.

I do not have permission to change the root directory, but I want to use the trash for my own account.

Version 0.12.7 won't trash to ecryptfs-mounted home directories

trash-cli refuses to trash files or directories from another partition to ~/.local/share/Trash when the home directory is mounted with ecryptfs. For example:

mkdir -p /tmp/foobarbaz
touch /tmp/foobarbaz/quux

$ trash /tmp/foobarbaz/quux
trash: cannot trash regular empty file `/tmp/foobarbaz/quux'

$ trash /tmp/foobarbaz
trash: cannot trash directory `/tmp/foobarbaz'

Encrypted home directories seems like a common enough scenario that it should be supported.

trash-rm by absolute path

Currently trash-rm searches file to delete by a basename. It would be good to have an option to delete the file by an absolute path

Can't trash regular file

Hi,

I'm trying to trash a file stored in the mounted drive /media/NameOfMyDrive.

eg.

$ touch something
$ trash-put something
trash-put: cannot trash regular file `something'

It works on home directory, but doesn't on a mounted drive.
Drive is exFat, and a .Trash- is present in the drive.
Maybe it has something to do with the permission of /media, although to create, delete file from mount doesn't require the admin permission

have -f flag ignore missing files

I think it would be nice if the -f flag causes trash-put to ignore missing files. trash-put currently prints an error message for missing files. If this is not acceptable, I would like to suggest a -s or --silent flag.

Man-page references wrong command

In the man pages for trash-put, trash-list and trash-empty, the "See also" section references "trash-restore" instead of the actual command "restore-trash".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.