rename

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package rename deals with renaming files and list images in directories

Index

Constants

View Source
const (
	DefaultCopyNumber = 2
	StatusFail        = "fail"
	StatusOk          = "ok"
	FileExistsError   = "File exists already"
)

Constant values

Variables

This section is empty.

Functions

func CheckFileExists

func CheckFileExists(path string, sourceName string) bool

CheckFileExists checks if a file is in a given dir.

func ListImagesInDir

func ListImagesInDir(rootPath string, extensions []string, excludedDirs []string, safeRename bool, safeStrings []string) (list []string, err error)

ListImagesInDir search through a directory for files with extensions that match. If a directory is excluded it will skip this directory.

func RenameImages

func RenameImages(files []FileInformation) error

RenameImages renames images.

Types

type FileInformation

type FileInformation struct {
	Path          string
	SourceName    string
	TargetName    string
	FileName      string
	NewFileName   string
	FileExtension string
	CopyNumber    int
	Status        string
}

FileInformation is a struct for file informations like target name and source name.

func GetFileInformation

func GetFileInformation(sourceNames []string, templateString string, separator string, debug bool) (files []FileInformation, tableData [][]string, err error)

GetFileInformation returns file informations from source names.

func (*FileInformation) BuildFileInformation

func (f *FileInformation) BuildFileInformation(sourceName string)

BuildFileInformation takes an source name as string. It assign values into the FileAttributes struct.

func (*FileInformation) GetNewFileName

func (f *FileInformation) GetNewFileName(templateString string, imageExif *exif.Exif) error

GetNewFileName assign the new filename into a FileAttributes struct.

func (*FileInformation) GetTargetName

func (f *FileInformation) GetTargetName(targetNames []string, separator string) error

GetTargetName assign the target name into a FileAttributes struct.

type FileNameTemplate

type FileNameTemplate struct {
	CameraModel string
	DateTime    string
}

FileNameTemplate is a struct for the template.

Jump to

Keyboard shortcuts

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