#Delete Folder the executeable is in
12 messages · Page 1 of 1 (latest)
but, softwares are usually installed under root or anywhere that require administrative access, like C drive in windows.
yea but how do I get the path
os.Args[0] is path to the binary.
use filepath.Dir to get the dir name
https://pkg.go.dev/path/filepath#Dir
so if I have it like that
/root/program/main
it return
/root/program/
try it
this is wrong
this won't work
this only will work assuming that the executable being ran is not in your PATH