remove_trash

package
v0.0.0-...-52f67f4 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package remove_trash exports the Traverse function, which traverses a path and removes all trash files and folders in it, reporting progress and calculating the size freed by the operation.

Index

Constants

This section is empty.

Variables

View Source
var Version string

Functions

This section is empty.

Types

type FailedPath

type FailedPath struct {
	Path string
	Err  error
}

Instead of throwing an error and stopping, the errors are collected and returned at the end. This represents files/folders which could not be deleted by os.RemoveAll

func Traverse

func Traverse(path string, dryRun bool, pr chan<- ProgressReport) ([]string, []FailedPath, error)

Traverses path, returning a list of files/folders that were removed. If dryRun is true, do not remove any file. pr is called to report progress.

type ProgressReport

type ProgressReport struct {
	Count uint64
	Total uint64
	Bytes uint64
}

The type of the function that is called to report progress. The arguments are, in order, the current count, the current total and the number of bytes freed by this operation (that is, so far). The total can and does change as files are discovered.

Jump to

Keyboard shortcuts

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