Replace fs.copy and fs.unlink by fs.rename