Delete all files on a server with a particular filename

Posted on

Delete all files on a server with a particular filename – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.

But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about linux, files, , , .

I wonder if you could help me please. I run 5GBFree.com a free hosting site. As you can imagine, it gets quite a few people signing up to abuse the service.

Recently I’ve found a LOT of people setting up sites with a particular script that floods forums and IRC chat rooms. The names of the files are as follows:

peindom1.php
peindom2.php
peindom3.php
peindom4.php

Is there a command I can run in linux to remove files with these filenames ANYWHERE on the server (so basically, a command to go through all folders on the server and remove instances of that name).

If you could help I would really appreciate it, and I’m sure the people who run the forums and IRC rooms getting spammed would also be grateful to you.

Kind regards,
Rob

Solution :

find / -type f -name peindom*.php -delete

see the find manpage for more info on using find. its definitely a command you want in your quiver

You could try

find / -xdev -name 'peindom[1-4].php' -exec rm {} +

Leave a Reply

Your email address will not be published. Required fields are marked *