API to remove file not working...

I want to remove a file by using API with php, but it seem doesn’t work.
what wrong with this?

//Remove Unwanted Files.
if($name==“record.txt”){
echo $id = $output[‘.id’];
$ARRAY= $API->comm(“/file/remove”, array(“.id”=>“$id”));
echo “File Removed”;
}

Does the RouterOS user have “write” and “ftp” policies? If they don’t, they can’t remove files either, not just add/edit files.

Also, in the arguments array, try to use “numbers” instead of “.id”.