Finding certain files
I am trying to find files on my system that match this type of pattern:
keyword1-keyword2-keyword3-keyword4.html
I'm trying to find accounts on the system set up by search engine spammers,
who keep creating/uploading files with these types of names. Please stick
to the topic. This isn't the place to discuss the why, who, where, how. I
am just trying to locate the files and remove them. Thanks!
Re: Finding certain files
On 2005-08-25, Shabam wrote:
> I am trying to find files on my system that match this type of pattern:
>
> keyword1-keyword2-keyword3-keyword4.html
>
> I'm trying to find accounts on the system set up by search engine spammers,
> who keep creating/uploading files with these types of names. Please stick
> to the topic. This isn't the place to discuss the why, who, where, how. I
> am just trying to locate the files and remove them. Thanks!
man locate
--
Chris F.A. Johnson <http://cfaj.freeshell.org>
============================================================ ======
Shell Scripting Recipes: A Problem-Solution Approach, 2005, Apress
<http://www.torfree.net/~chris/books/cfaj/ssr.html>
Re: Finding certain files
> man locate
Perhaps my question wasn't clear enough. I have been using locate to find
files. However, what should I use as a pattern match? Most times it's one
keyword followed by a "-" with anotehr, etc. usually up to 5 keywords, then
".html".
Re: Finding certain files
In article <3o-dnVjhiMCszJDeRVn-2A [at] adelphia.com>, Shabam
<chalupa [at] yomama-nospam.com> wrote:
> > man locate
>
> Perhaps my question wasn't clear enough. I have been using locate to find
> files. However, what should I use as a pattern match? Most times it's one
> keyword followed by a "-" with anotehr, etc. usually up to 5 keywords, then
> ".html".
>
In Perl, you can match key1-key2-key3-etc.html with the regular
expression
m/(\w+-)+\.html/
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
Re: Finding certain files
find / -name \*.html | egrep '[^\-]-[^\-]-[^\-]-[^\-]'
Shabam wrote:
> I am trying to find files on my system that match this type of pattern:
>
> keyword1-keyword2-keyword3-keyword4.html
>
> I'm trying to find accounts on the system set up by search engine
> spammers,
> who keep creating/uploading files with these types of names. Please stick
> to the topic. This isn't the place to discuss the why, who, where, how.
> I am just trying to locate the files and remove them. Thanks!
--
Remove '.nospam' from e-mail address to reply by e-mail
Re: Finding certain files
On Wed, 24 Aug 2005 21:32:11 -0700, Shabam thoughtfully wrote:
> I am trying to find files on my system that match this type of pattern:
>
> keyword1-keyword2-keyword3-keyword4.html
>
> I'm trying to find accounts on the system set up by search engine
> spammers, who keep creating/uploading files with these types of names.
> Please stick to the topic. This isn't the place to discuss the why, who,
> where, how. I am just trying to locate the files and remove them. Thanks!
My post didn't show up in my newserver so I suggested:
$ find / -iname "*keyword1*html" -o -iname "*keyword2*html" -o -iname
"*keyword3*html" -o -iname "*keyword4*html" -type f -exec rm {} \;
## or being safe
#!/bin/sh
find / \( -iname "*keyword1*html" -o -iname "*keyword2*html" -o -iname
"*keyword3*html" -o -iname "*keyword4*html" > /tmp/delete_these.ans
tar --remove-files -zcvf /tmp/spamcrap$(date +%y%j).tgz -T
/tmp/delete_these.ans