As many have said before, there's no straightforward way to fully 'hide' a file like that.
If you can accept not truly hiding the file but merely obfuscating it, you can always embed it inside a dummy file. Take the file you want to hide, build a container file to hold it, and name that dummy file with a random name. For example, you could place the real file's filename starting at offset 512 of the dummy file and place the file's contents starting at offset 1024, inserting 64 bytes of random data every 1KB. Pad the end with empty space out to the nearest multiple of 4KB, fill the empty space with random bytes, and generate a random sequence of characters to use for a filename. Now, you can "hide" the file while it's still visible in the filesystem.
However, that's merely "security by obscurity" and can be defeated by a clever attacker with a hex editor.
If you're simply trying to make sure a file isn't visible to the casual filesystem browser, you can always compress the file, encrypt it, and randomize the filename. If you need to be able to access/execute the file as-is while it is "hidden", then you're probably (hopefully) out of luck.