Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lorca creates temp folders on everey run #163

Open
AntonMinaev opened this issue Dec 17, 2021 · 0 comments
Open

Lorca creates temp folders on everey run #163

AntonMinaev opened this issue Dec 17, 2021 · 0 comments

Comments

@AntonMinaev
Copy link

AntonMinaev commented Dec 17, 2021

context: I am developing a gallery with more than 2000 photos

I noticed that during development, the space on the C drive is rapidly disappearing. And I found that Lorca creates temporary folders (lorca2959578984 - like these) every time you start it in C:\Users\USERNAME\AppData\Local\Temp

For myself, I solved the problem with a function that deletes all such folders, except for the very last one:

func removeLorcaTemp() {
	var lfolders []TmpFolder
	dirname, err := os.UserHomeDir()
	if err != nil {
		log.Fatal(err)
	}
	p := dirname + \"\\AppData\\Local\\Temp\"
	sf, err := scanFolder(p) //custom function waslks the path
	for _, path := range sf {
		if strings.Contains(path, "lorca") {
			f, err := os.Stat(p + "\\" + path)
			if err != nil {
				log.Fatalf("err reading: %v", err)
			}
			lfolders = append(lfolders, TmpFolder{path, f.ModTime().Unix()})
		}
	}
	sort.SliceStable(lfolders, func(i, j int) bool {
		return lfolders[i].Time < lfolders[j].Time
	})

	for i, f := range lfolders {
		if i != len(lfolders)-1 {
			fmt.Println(f)
			err := os.RemoveAll(p + "\\" + f.Path)
			if err != nil {
				log.Println(err)
			}
		}
	}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant