This commit is contained in:
Gregory Salaun 2023-12-17 19:40:19 +07:00
parent b09c54efd7
commit 5d39dbcea8

View File

@ -102,9 +102,19 @@ func main() {
log.Println("Found file: " + v.Name())
if filepath.Ext(v.Name()) == ".mkv" {
mkvCount += 1
} else {
os.Remove(m.SourceFolder + "/" + v.Name())
log.Printf("Deleting file non MKV file: %v", m.SourceFolder+"/"+v.Name())
}
}
log.Printf("Found %v MKV files in the folder", mkvCount)
if mkvCount > 1 {
log.Printf("Found %v MKV files in the folder, deleting only %v", mkvCount, m.SourcePath)
os.Remove(m.SourcePath)
} else {
log.Printf("Found only one MKV files in the folder, deleting thoe folder %v", m.SourceFolder)
os.RemoveAll(m.SourceFolder)
}
// if not in folder just delete the file
} else {