gio-tool-trash: Add --restore subcommand

It search for attribute trash::orig-path and move the input file to it.
Possibly recreating the directory of orignal path and/or overwritting
the destination.

Closes #2098

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
This commit is contained in:
Frederic Martinsons
2020-12-07 16:46:14 +01:00
parent 105e06cc2e
commit 725984fe8e
2 changed files with 99 additions and 8 deletions

View File

@@ -678,17 +678,18 @@
<arg choice="opt" rep="repeat"><replaceable>LOCATION</replaceable></arg>
</term>
<listitem>
<para>Sends files or directories to the Trashcan. This can be a
different folder depending on where the file is located, and not
all file systems support this concept. In the common case that the
file lives inside a users home directory, the trash folder is
<para>Sends files or directories to the Trashcan or restore them from
Trashcan. This can be a different folder depending on where the file
is located, and not all file systems support this concept. In the common
case that the file lives inside a users home directory, the trash folder is
<filename><envar>$XDG_DATA_HOME</envar>/Trash</filename>.</para>
<para>Note that moving files to the trash does not free up space on
the file system until the Trashcan is emptied. If you are interested
in deleting a file irreversibly, see the <command>remove</command> command.</para>
<para>Inspecting and emptying the Trashcan is normally supported by
graphical file managers such as Nautilus, but you can also see the
trash with the command: <command>gio list trash://</command>.</para>
trash with the command: <command>gio trash --list</command> or
<command>gio list trash://</command>.</para>
<refsect3>
<title>Options</title>
<variablelist>
@@ -704,6 +705,12 @@
<term><option>--list</option></term>
<listitem><para>List files in the trash with their original locations</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--restore</option></term>
<listitem><para>Restore a file from trash to its original location. A URI beginning
with <literal>trash://</literal> is expected here. If the original
directory doesn't exist, it will be recreated.</para></listitem>
</varlistentry>
</variablelist>
</refsect3>
</listitem>