Re: Parsing a file name in the shell

2002-02-06 Thread Nathan E Norman
On Wed, Feb 06, 2002 at 10:26:47AM -0500, Ron Mullins wrote: > Can someone help me this? We run a FTP server that has constant > scriptkiddie activity, i.e. uploading of warez. I would like to automate > the removing of directories, as they are always a number, but I can't > figure out how to test

Re: Parsing a file name in the shell

2002-02-06 Thread Ron Mullins
On Wed, 2002-02-06 at 11:52, Mark Asselstine wrote: > You can shorten > rm -rf {1,2,3,4,5,6,7,8,9,0}foo > to > rm -rf [0-9]* > > This will remove any file or directory which has a numeric beginning for > the > directory you run the command from. Ideally you would put this in an > executable > scri

Re: Parsing a file name in the shell

2002-02-06 Thread Ron Mullins
On Wed, 2002-02-06 at 11:19, Andrew Perrin wrote: > Note the rm -rf line, which does what you're asking. But note also that > script kiddies may be capable of generating other devious filename > patterns, including those that start with . . Yeah, I've seen that and worse, but most of those names

Re: Parsing a file name in the shell

2002-02-06 Thread Ron Mullins
On Wed, 2002-02-06 at 10:51, Ron Johnson wrote: > Try: >ls [0-9]* > > This is a minimalistic use of Regular Expressions. A simple script to > delete these sub-directories might be: > #!/bin/sh > for i in `ls [0-9]*`; do > echo $i > rm -rf $i > done > Thanks, that is exact

Re: Parsing a file name in the shell

2002-02-06 Thread Emil Pedersen
Ron Mullins wrote: > > Can someone help me this? We run a FTP server that has constant > scriptkiddie activity, i.e. uploading of warez. I would like to automate > the removing of directories, as they are always a number, but I can't > figure out how to test whether the name is or starts with a nu

Re: Parsing a file name in the shell

2002-02-06 Thread Andrew Perrin
How about this? [EMAIL PROTECTED]:~/tmp$ ls [EMAIL PROTECTED]:~/tmp$ touch 1foo [EMAIL PROTECTED]:~/tmp$ touch 2foo [EMAIL PROTECTED]:~/tmp$ touch foo [EMAIL PROTECTED]:~/tmp$ ls -la total 12 drwxr-sr-x2 aperrin aperrin 4096 Feb 6 11:18 . drwxr-sr-x 49 aperrin aperrin 8192 Feb