how to replace file with an empty file of the same name?
To replace a file with a zero byte file use a combination of unlink() and touch():

unlink($file_path);
touch($file_path);


To move a file to a different folder use Drupal's file_move():

file_move($src_file_path, $dest_file_path);


To rename a file use rename():

rename($file_path);


All of the above make the assumption that your webserver user has read access over the source path, and write access to the destination path.

EDIT

Your original question asked about moving/renaming files as well, I'll leave the answer to those in just in case you're still wondering.