Filename with timestamp

(imported topic written by var91)

hi,

is it possible to create a file on a Windows Client, which look like e.g. “TEMrunning_24.03.2011 11:00.trg”

I create a Fixlet but it is not working correct.

Have anybody an idea?

Thanke a lot.

Andi

parameter “config” = “{pathname of csidl folder 38 & “\BigFix Enterprise\TEMrunning_” & “{date (local time zone) of now)}” & “.trg”}”

createfile until end

Operating system = {name of operating system}

Processor count = {number of processors}

end

delete “{parameter “config”}”

copy __createfile “{parameter “config”}”

(imported comment written by NoahSalzman)

Well, at the very least, you have an extra ) after now.

(imported comment written by SystemAdmin)

Yes.

You are very close, but there are a couple of issues with your first line

a) You can not use the {} inside of the outer pair of {}, as you’ve already ‘requested’ that the relevance parser should act upon this string section. Just create the relevance as you’d expect it to work and then wrap the entire thing in a single set of {}.

b) If you really just want a date string like “Thu, 24 Mar 2011”, then ‘current date’ would be a bit simpler. However, you are including the hour and minutes as part of your timestamp, thus you’ll want to use the whole ‘now’ string.

The string concatenation with &'s work fine, you’ll just need to insert the following code to get the date string:

((first 2 of it &"."& (last 3 of first 6 of it as month as two digits) &"."& last 4 of first 11 of it &" "& last 5 of it) of (last 17 of first 22 of (now as string)))

There are many ways to do relevance, but when pulling parts of a string apart, I find its easier to try to reduce the intial string to the bare minimum and then pull that apart. So for the stuff you need, we’ll need to get the base chunk.

Q: (last 17 of first 22 of (now as string))

A: 24 Mar 2011 15:13

From there it’s just coming up with other bits of relevance to pull out the parts. The only part that is more than just doing string segmentation, is the month conversion:

Q: (last 3 of first 6 of it as month as two digits) of (last 17 of first 22 of (now as string))

A: 03

Hope this helps.

-Jim