Delete cPanel files using FTP

Here’s how to delete every occurence of a filename automatically from file manager using FTP.

Nov 4, 2023

Delete cPanel files using FTP


I had the task of cleaning up a WordPress website that had been infected with malware.

One of the things I discovered was each file path having a .htaccess file, which was clearly a product of malware.

Manually deleting the files was a herculean task since every single folder and subfolders in every folder had the .htaccess file, from plugins to themes.



It was clear the solution was to delete them all automatically using FTP.

After logging into Filezilla with my FTP details, these were the steps I took:

  1. Press F3 to start the search
  2. Use Filename is equal to as criterion and enter the name of the file.
  3. Let the search finish.
  4. Use CTRL+A to mark all found files, then right click – Delete.
  5. Now, FileZilla will attempt to delete these files. Unless the attacker did protect them somehow, this should do.

Thankfully, it went smoothly and in a matter of minutes, I was able to fix what would’ve ordinarily cost me days.