Solved

Deleting the same named file located in multiple directories in a LAMP Server

Posted on 2006-07-24
1
248 Views
Last Modified: 2010-04-20
Good Afternoon,

I have a single file that shows up in multiple subdirectories off of the home directory on a LAMP server. The file is called wedo.php. There are possibly 300 of them in various directories under home and I need to delete them all. Is there a way to do a mass located and then a mass delete?

I am in a bit of hurry for this so any help you can give would be appreciated.

0
Comment
Question by:safepointmedia
1 Comment
 
LVL 22

Accepted Solution

by:
pjedmond earned 500 total points
ID: 17170113
******STOP*******

I forgot to change the file name!!!! Obviously make a backup before doing!

Correct scripts are:


find /var/www/ | grep "wedo\.php$" | awk {'print "rm " $1 '} | /bin/bash

Will do it.

To test without running the command:

find /var/www/ | grep "wedo\.php$" | awk {'print "rm " $1 '}

(   (()
(`-' _\
 ''  ''

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In this tutorial I will explain how to make squid prevent malwares in five easy steps: Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-…
Daily system administration tasks often require administrators to connect remote systems. But allowing these remote systems to accept passwords makes these systems vulnerable to the risk of brute-force password guessing attacks. Furthermore there ar…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now