Re: string manipulation experts...

From: Lee Peedin (lee_at_DONOTSPAMMEsafedatausa.com)
Date: 09/23/04


Date: Thu, 23 Sep 2004 12:51:36 -0400

Phil,

A couple of questions concering the AppName.

Are the AppNames a pre-defined list? If so (and the list is small
enough) you could examine the first n characters of the filename to
determine the app name (n characters being the same length as the list
item you're looking for).

Will the AppNames ever have numeric digits in their name? If not, you
could examine each character from left to right and determine if it is
numeric. If not, add that character to your newname, until you've
pulled out all the parts. Once you encounter a numeric digit, you
know that you've begun reading the date. From that point on continue
to read until you find an "s" or a "." (s being the first character of
the literal "stdError" and a . meaning that you've got to the end of
the filename - less the extension).

Thorsten has made a good point about the date stored in the name vs.
the file creation date. I would think they would be one the same;
therefore getting the date for the new name shouldn't be a problem and
of course you would want to use the 8 digit date as part of your new
name.

Just some thoughts

Lee

On Thu, 23 Sep 2004 10:39:58 -0400, "Phil Strack"
<philstrack@hotmail.com> wrote:

>Hi-
>I've inherited a production system that spits out logs that are named
><AppName><Date>.log and <AppName>stdError<Date>.log where
>AppName is the text name of the application
>Date is in the format YYYYmd
>and stdError is literal. (examples: application2004923.log,
>applicationstdError2004923.log)
>These logs are created by an application that was developed by an outside
>resource who is no longer available and has become a "black box" to our
>internal staff. (and of course, no one wants to pony up some money to get
>some expertise in to make the modification in the application)
>
>I've been asked to archive the log files to a different storage location and
>rename them to a convention more sortable by name. No problems with the
>archiving piece, but having a problem with the renaming and am seeking
>suggestions.
>The new naming convention is AppName-<Date>.log and AppName-<Date>-Err.log
>where date is in the format: mmddyyyy. (examples: application-09232004.log,
>application-09232004-Err.log)
>
>The problem is this:
>I am polling the log output folder using the CIM_Datafile class to return a
>collection of files to archive and I can not figure out how to grab ONLY the
>date part out of each of the original logs for parsing out and insertion
>into the new log name.
>I've tried to count the characters and take the necessary ones out of the
>string but there are 2 circumstances where that does not work. One when the
>day is a single character and month is 2 characters and the other is when
>the day is 2 characters and month is a single character. These two scenarios
>give the same count character count but I can not account for which date
>part has one or two characters.
>
>Any guidance provided would be greatly appreciated.
>
>Thanks
>



Relevant Pages

  • Re: string manipulation experts...
    ... > These logs are created by an application that was developed by an outside ... > archiving piece, but having a problem with the renaming and am seeking ... > I've tried to count the characters and take the necessary ones out of the ... > the day is 2 characters and month is a single character. ...
    (microsoft.public.scripting.vbscript)
  • Re: string manipulation experts...
    ... Traverse the name portion of the string from right to left in 1 char units ... > These logs are created by an application that was developed by an outside ... > archiving piece, but having a problem with the renaming and am seeking ... > I've tried to count the characters and take the necessary ones out of the ...
    (microsoft.public.scripting.vbscript)
  • string manipulation experts...
    ... Date is in the format YYYYmd ... These logs are created by an application that was developed by an outside ... archiving piece, but having a problem with the renaming and am seeking ... I've tried to count the characters and take the necessary ones out of the ...
    (microsoft.public.scripting.vbscript)
  • Re: string manipulation experts...
    ... The app name isn't a problem it is always a static, fixed length string. ... A couple of questions concering the AppName. ... determine the app name (n characters being the same length as the list ...
    (microsoft.public.scripting.vbscript)
  • Re: const char * to char[]
    ... You happen to know that your string fits now, ... what would happen if AppName were exactly 64 characters long, ... > string AppName points to could be code memory? ...
    (comp.lang.c)