trash

package
v0.0.0-...-a0d3116 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2019 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package trash provides easy access to the trash bin. For more information, see the trash spec: https://standards.freedesktop.org/trash-spec/trashspec-latest.html

TODO: Make New work.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Empty

func Empty() error

Empty erases all files in the trash.

func Erase

func Erase(s string) error

Erase removes the given file from the trash.

func EraseAll

func EraseAll(s string) error

EraseAll removes the given file and all children from the trash.

func Files

func Files() ([]string, error)

Files returns a slice of the files in the default trash.

func IsEmpty

func IsEmpty() bool

IsEmpty returns whether or not the trash is empty.

func Restore

func Restore(s string) error

Restore moves the file from the trash to its original location.

func RestoreTo

func RestoreTo(s, p string) error

RestoreTo moves the file from the trash to the specified location.

func Trash

func Trash(p string) error

Trash moves the given file to the trash.

Types

type Dir

type Dir struct {
	// contains filtered or unexported fields
}

Dir represents a trash directory.

func New

func New(root string) (*Dir, error)

New creates a new Trash directory.

func (*Dir) Empty

func (d *Dir) Empty() error

Empty erases all the files in the trash.

func (*Dir) Erase

func (d *Dir) Erase(s string) error

Erase removes the given file from the trash.

func (*Dir) EraseAll

func (d *Dir) EraseAll(s string) error

EraseAll removes the given file and any children it contains.

func (*Dir) Files

func (d *Dir) Files() ([]string, error)

Files returns a slice of the files in the trash.

func (*Dir) IsEmpty

func (d *Dir) IsEmpty() bool

IsEmpty returns whether or not the trash is empty.

func (*Dir) Restore

func (d *Dir) Restore(s string) error

Restore moves the file from the trash to its original location.

func (*Dir) RestoreTo

func (d *Dir) RestoreTo(s, p string) error

RestoreTo moves the file from the trash to the specified location.

func (*Dir) Stat

func (d *Dir) Stat(s string) (*Info, error)

Stat returns the Info for the given file in the trash.

func (*Dir) Trash

func (d *Dir) Trash(p string) error

Trash moves the file at the given path to the trash.

type Info

type Info struct {
	Path         string
	DeletionDate time.Time
}

Info represents a .trashinfo file.

func NewInfo

func NewInfo(r io.Reader) (*Info, error)

NewInfo creates a new Info using the given io.Reader.

func Stat

func Stat(s string) (*Info, error)

Stat returns the Info for the given file in the trash.

func (*Info) String

func (i *Info) String() string

String returns Info as a string in the INI format.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL