About a week ago on my screen (Mac Book Pro 2017) there was suddenly a folder called "path" when you opened it there was a folder called "to" and then a folder called "dir". I didn't know where it was coming from and was afraid that I would be hacked. Because of that, I put my laptop back on but now the folder is back. Was I hacked or something? Or what can that be? The last thing I downloaded was "Melodics", can it have anything to do with it?
No you weren't.
So what is that?
Download Malwarebytes and let it run over it… It's quite good and detects a lot of harmful files or similar.
These are normal folders and are part of the system. Otherwise do what marcman03 said.