picster

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2020 License: MIT Imports: 14 Imported by: 0

README

Picster

A project to manage pictures and videos

Usage

picster <source folder> <destination folder>

will scan the source folder recursively for pictures and videos and will move these files into the destination folder with an organized structure:

destination
    fotos
        yyyy-mm
            yyyymmdd_hhmmss.jpg
        ...
    videos
        yyyy-mm
            yyyymmdd_hhmmss.mov
            yyyymmdd_hhmmss.mp4
            yyyymmdd_hhmmss.avi
        ...

Contributing

Pull requests are welcome!

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyDelFile

func CopyDelFile(sourcePath, destPath string, log *logrus.Entry)

CopyDelFile create file, copy content, delete old

func CopyDir

func CopyDir(src string, dst string) (err error)

CopyDir recursively copies a directory tree, attempting to preserve permissions. Source directory must exist, destination directory must *not* exist. Symlinks are ignored and skipped.

func CopyFile

func CopyFile(src, dst string) (err error)

CopyFile copies the contents of the file named src to the file named by dst. The file will be created if it does not already exist. If the destination file exists, all it's contents will be replaced by the contents of the source file. The file mode will be copied from the source and the copied data is synced/flushed to stable storage.

func FileExists

func FileExists(path string) bool

FileExists returns true, if file exists, false otherwise

func Move

func Move(files []Result)

Move moves the files

func MoveFile

func MoveFile(source string, destination string, log *logrus.Entry)

MoveFile move file by using os.Rename Fallback to copy in case of error

Types

type Configuration

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

Configuration holds the possible parameter values

func GetConfiguration

func GetConfiguration() (config Configuration)

GetConfiguration returns Configuration with current values

type Result

type Result struct {
	SourcePath string
	DestPath   string
	Md5        string //[md5.Size]byte
	Status     string
	Err        string //error
}

Result A result is the product of reading and summing a file using MD5.

func ScanDir

func ScanDir(root string, dest string) ([]Result, error)

ScanDir reads all the files in the file tree rooted at root and returns a map from file path to the MD5 sum of the file's contents. If the directory walk fails or any read operation fails, MD5All returns an error. In that case, MD5All does not wait for inflight read operations to complete.

Jump to

Keyboard shortcuts

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