I create files that cannot be deleted

I was using file_put_contents and accidentally use the date as filename so now i have 5 files with this format \"10 23\", in my htdocs folder, i think that the ftp thing is seing the \ at the start and thinking its a folder
i try to delete them via Winscp and the filemanager in cpanel

error that is displayed:

Prohibited file name: /htdocs/\"10 22\", (Winscp)

Error during FTP delete file, at "/htdocs/\"10 23\",": Delete of /htdocs/\"10 23\", failed (path: /htdocs/\"10 23\",). (monsta)

fixed, ftp sees the files as a directory i think so… i delete them the way i create them

if you are having the same issue, try creating a file with this code

<? php
$file = '\"10 23\",'; //here between the '' you put the name of the file (if the filename has ' use " at the start and end of the filename)
if (!unlink($file)) { 
  echo ("no $file");
} else {
  echo ("yes $file");
} //this ecoes the filename and "no" if theres an error and "yes" if the file was deleted

I think it wouldn’t be a good idea to create those files. this server is a Linux Server that doesn’t support back slashes.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.