typo, logs, modules, todo

master
Philipp Häfelfinger 5 years ago
parent cdaabe99a2
commit 698488324b

@ -1,4 +1,5 @@
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=

@ -32,15 +32,17 @@ func Run() {
logErrorAndExit(err, 2) logErrorAndExit(err, 2)
} }
filesWithMissingSidecar := getJpesWithoutRawSideCar(jpgFiles) filesWithMissingSidecar := getJpegsWithoutRawSideCar(jpgFiles)
logrus.Infof("Found %d of %d images to delete in %s", len(filesWithMissingSidecar), len(jpgFiles), imagesRootFolder) logrus.Infof("Found %d of %d images to delete in %s", len(filesWithMissingSidecar), len(jpgFiles), imagesRootFolder)
//todo: this check needs to be performed by each directory and if true, skip the directory but not all
if len(jpgFiles) == len(filesWithMissingSidecar) { if len(jpgFiles) == len(filesWithMissingSidecar) {
logrus.Warnf("Did not find any sidecar files in %s. Are you sure this is the right path to look for jpgs without raw sidecars? Cancelling executing!", imagesRootFolder) logrus.Warnf("Did not find any sidecar files in %s. Are you sure this is the right path to look for jpgs without raw sidecars? Cancelling executing!", imagesRootFolder)
logErrorAndExit(errors.New("Total files of jpegs and missing sidecars are the same, cancelling!"), 3) logErrorAndExit(errors.New("Total files of jpegs and missing sidecars are the same, cancelling!"), 3)
} }
if !(*dryRun) { if !(*dryRun) {
logrus.Infof("Starting to delete %d files...", len(filesWithMissingSidecar))
deleteFiles(filesWithMissingSidecar) deleteFiles(filesWithMissingSidecar)
} else { } else {
logrus.Warnln("Skipping delete of images as flag dryRun is set to true!") logrus.Warnln("Skipping delete of images as flag dryRun is set to true!")
@ -63,7 +65,7 @@ func logErrorAndExit(err error, exitCode int) {
os.Exit(exitCode) os.Exit(exitCode)
} }
func getJpesWithoutRawSideCar(jpgFiles []string) []string { func getJpegsWithoutRawSideCar(jpgFiles []string) []string {
var filesWithMissingSidecar []string var filesWithMissingSidecar []string
for _, jpgFile := range jpgFiles { for _, jpgFile := range jpgFiles {
dir, fileName := filepath.Split(jpgFile) dir, fileName := filepath.Split(jpgFile)

Loading…
Cancel
Save