I used this to hide the file:
File.SetAttributes(path, File.GetAttributes(path) | FileAttributes.Hidden);
But when I wanted to unhide that file, the file just got deleted, but in the code I didn't get any error, so the file is still there.
File.SetAttributes(path, File.GetAttributes(path) | ~FileAttributes.Hidden);