<?php function move($source, $dest) { if(!copy($source, $dest)) return false; if(!unlink($source)) return false; return true; } if(!move("data.txt", "/tmp/tmpdir/newfile.txt")) { echo "Error! Couldn't move the file!<BR>"; } ?>