diskusage

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2019 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const DepthDefault = 1 //default depth in results

DepthDefault - default Depth value

View Source
const LimitDefault = 10 //default value for a arglimit

LimitDefault - default Limit value

View Source
const SortDefault = "size_desc"

SortDefault - default Sort value

Variables

This section is empty.

Functions

func AddPathSeparator

func AddPathSeparator(path string) string

AddPathSeparator - add os path separator to string

func CleanPath

func CleanPath(path *string, isrelativeclean bool) string

CleanPath - get absolute path like C:\temp\

func GetAdaptedSize

func GetAdaptedSize(sizeB int64, fixunit string) (float64, string)

GetAdaptedSize - get file size adapted to InputArgs.FixUnit units or to a flexible useful units

func ScanDir

func ScanDir(files *TFiles, path string, depth int) int64

ScanDir - scan directory and return its size

Types

type OverallInfo

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

OverallInfo -

func (*OverallInfo) PrintOverallInfo

func (info *OverallInfo) PrintOverallInfo()

PrintOverallInfo -

type TFile

type TFile struct {
	RelativePath           string
	Name                   string
	Size                   int64
	IsDir                  bool
	IsLink                 bool
	LinkedDirPath          string
	Depth                  int
	IsNotAccessible        bool
	IsNotAccessibleMessage string
	AdaptedSize            float64
	AdaptedUnit            string
}

TFile - struct for file object

func ScanFile

func ScanFile(path string, name string, depth int) *TFile

ScanFile - scan dir/file parameters

func (*TFile) SetAdaptedSizeOfFile

func (file *TFile) SetAdaptedSizeOfFile(inputArgs *TInputArgs)

SetAdaptedSizeOfFile - set file properties: AdaptedSize & AdaptedUnit

type TFiles

type TFiles []TFile

TFiles - struct for files array object

func (*TFiles) CalculateMaxLenFilename

func (files *TFiles) CalculateMaxLenFilename() int

CalculateMaxLenFilename - calculating max length filename in files

func (*TFiles) GetOverallInfo

func (files *TFiles) GetOverallInfo(totalTime time.Duration) *OverallInfo

GetOverallInfo -

func (*TFiles) PrintFilesSizes

func (files *TFiles) PrintFilesSizes()

PrintFilesSizes - print out sizes of files

func (*TFiles) Sort

func (files *TFiles) Sort(by string)

Sort - sort files by size

type TInputArgs

type TInputArgs struct {
	Path    string //analysed path
	Limit   int    //limit folders in results
	Depth   int    //depth of subfolders in results (-1 - all, 1 - only current, 2 and more - 2 and more)
	FixUnit string //fixed size unit in a results presetation (b, Kb, Mb, ...). Has a upper priority than "argmaxunit". Must be in sizeUnits.
	Sort    string //results sorting by
}

TInputArgs - the programm arguments

var InputArgs TInputArgs

InputArgs - input arguments

func (TInputArgs) PrintArguments

func (t TInputArgs) PrintArguments()

PrintArguments - print arguments

func (*TInputArgs) SetDepth

func (t *TInputArgs) SetDepth(depth *int) error

SetDepth - init Depth field

func (*TInputArgs) SetFixUnit

func (t *TInputArgs) SetFixUnit(fixunit *string) error

SetFixUnit - init FixUnit field

func (*TInputArgs) SetLimit

func (t *TInputArgs) SetLimit(limit *int) error

SetLimit - init Limit field

func (*TInputArgs) SetPath

func (t *TInputArgs) SetPath(inpath *string) error

SetPath - init Path field

func (*TInputArgs) SetSort added in v1.3.2

func (t *TInputArgs) SetSort(sort *string) error

SetSort - init Sort field

Jump to

Keyboard shortcuts

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