andreafrancia / trash-cli

Command line interface to the freedesktop.org trashcan.
GNU General Public License v2.0
3.63k stars 177 forks source link

trash --trash-dir=/tmp/.Trash a.txt failed #195

Closed iysheng closed 3 years ago

iysheng commented 3 years ago

When i try to trash files to /tmp.Trash direction, then it doesn't work.

┗─╼[~]
▸ trash-put --trash-dir=/tmp/.Trash a.txt -v
trash-put: Volume of file: /
trash-put: Trash-dir: /tmp/.Trash from volume: /tmp
trash-put: cannot trash regular file 'a.txt'
┏─╼[yangyongsheng]╾─╼[10:54:20]╾─╼[74]
┗─╼[~]
▸ trash --trash-dir=/tmp/.Trash a.txt -v
trash: Volume of file: /
trash: Trash-dir: /tmp/.Trash from volume: /tmp
trash: cannot trash regular file 'a.txt'
┏─╼[yangyongsheng]╾─╼[10:54:32]╾─╼[74]
┗─╼[~]
▸ ll /tmp/.Trash/
┏─╼[yangyongsheng]╾─╼[10:56:32]╾─╼[0]
┗─╼[~]
▸ ll /tmp/.Trash/ -a
drwxrwxrwt yangyongsheng yangyongsheng   40 B  Wed Mar  3 10:48:44 2021  .
drwxrwxrwt root          root          13.5 KB Wed Mar  3 10:56:31 2021  ..

I do not know why this happend?

mattbui commented 3 years ago

@iysheng you can only trash file into a trash folder in the same volume (disk). Apparently, a.txt is under / volume while /tmp is a different volume

iysheng commented 3 years ago

@iysheng you can only trash file into a trash folder in the same volume (disk). Apparently, a.txt is under / volume while /tmp is a different volume

thanks for your reply, now i can trash files to /.Trash directory. But when I want to see what files i trash in /.Trash. It does not work. #189

mattbui commented 3 years ago

thanks for your reply, now i can trash files to /.Trash directory. But when I want to see what files i trash in /.Trash. It does not work. #189

yeah, seem like trash-list lack --trash-dir option, my workaround: find /your/trash/dir/info/*.trashinfo -exec cat {} +. trash-empty and trash-restore still worked with --trash-dir option so it's fine I think.

iysheng commented 3 years ago

thanks for your reply, now i can trash files to /.Trash directory. But when I want to see what files i trash in /.Trash. It does not work. #189

yeah, seem like trash-list lack --trash-dir option, my workaround: find /your/trash/dir/info/*.trashinfo -exec cat {} +. trash-empty and trash-restore still worked with --trash-dir option so it's fine I think. if the code as

do_trash_list()
{
find /.Trash/info/*.trashinfo -exec cat {} + 2> /dev/null
}
alias rtrash-list=do_trash_list

will be better? :thinking:

andreafrancia commented 3 years ago

With commit f11df22ffac87102289fa7dbac955a484133bd1c trash-list learnt a new option: --trash-dir.