[mrtg] Re: Dir parsing problem

Alistair.McGlinchy at marks-and-spencer.com Alistair.McGlinchy at marks-and-spencer.com
Thu Jul 12 13:02:01 MEST 2001


I believe the problem here is the OS is (secretly :-) preserving the old 8.3
naming convention. If you run "dir /x" on an NT system you will see the that
the file is also know as something link test~1.cfg. (I'm not sure what the
flag is for Win9x). Hence the reason why "dir" and "for" find and use these
files.

As a quick fix you could try:

To get dir to return only the files you are interested in run:
  dir *.cfg | perl -le "print if /\.cfg$/i"

To replace:   for %1 in (*.cfg) do blah.bat %1 
  dir /b *.cfg | perl -ne"print `blah.bat $_` if /\.cfg$/i"

Alistair
> -----Original Message-----
> From:	Neil Pike [SMTP:NeilPike at compuserve.com]
> Sent:	12 July 2001 11:31
> To:	mrtg at list.ee.ethz.ch
> Subject:	[mrtg] Dir parsing problem
> 
> 
>  I'm stumped on this one.  I use a batch file and a FOR loop to process
> all
> my cfg files, which works fine except it also picks up any temporary files
> that MRTG creates with _l_l..... at the end.
>  
>  I want to be able to get a list back of just files that end in ".cfg" for
> a batch file that uses a FOR loop.  However, I also get passed back files
> like the one below - "test.cfg_l_l".  Any ideas on how I can ignore these
> files?
>  
>  You get the same result with a dir command - e.g. dir *.cfg, dir *.cf?
> all
> return these files and I don't want them.....
> 
> 10/07/2001  14:13                9,136 RSTOKEATM1.Cfg
> 10/07/2001  14:13                9,138 RSTOKEATM2.Cfg
> 11/07/2001  16:21                6,744 snaserver.cfg
> 19/05/2001  20:57                5,621 SOS-MCC-R1.Cfg
> 19/05/2001  20:57                4,559 SOS-MCC-R2.Cfg
> 12/07/2001  10:39                    4 test.cfg_l_l    
> 
> Neil Pike
> 
__________________________________________________________________________________________

Registered Office:
Marks and Spencer p.l.c
Michael House, Baker Street,
London, W1U 8EP
Registered No. 214436 in England and Wales.

Telephone  (020) 7935 4422
Facsimile  (020) 7487 2670

www.marksandspencer.com

Please note that electronic mail may be monitored.

This e-mail is confidential. If you received it by mistake, please let us know and then
delete it from your system; you should not copy, disclose, or distribute its contents to
anyone nor act in reliance on this e-mail, as this is prohibited and may be unlawful
_________________________________________________________________________________________

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the mrtg mailing list