Hi,
I’m currently trying to export all secrets in /ppp secret into a file with $identity$date$time as name.
The code is as follows
:global date ([:pick [/system clock get date] 0 12]);
:global time ([:pick [/system clock get time] 0 9]);
:local fileName (.[system identity get name]"$date""$time")
:local rsc $fileName
/ppp secret export file=$rsc;
But it only outputs files with the time as name.
Can anyone tell me why it would do so?
THX
strods
July 28, 2017, 11:06am
2
Try this:
:local fileName ([system identity get name] . “". [:pick [/system clock get date] 0 12] . " ”. [:pick [/system clock get time] 0 9] . “.rsc”)
/ppp secret export file=$rsc;
pe1chl
July 28, 2017, 11:07am
3
The problem is that the date contains slashes (‘/’) and this is an invalid character in a filename because it is the directory-filename separator.
So you must do more picking to get only the variable data and not the separator characters from the date.
Thank you for your hints, now it works.
:global date ([:pick [/system clock get date] 0 3] . [:pick [/system clock get date] 4 6] . [:pick [/system clock get date] 7 11]);
:global time ([:pick [/system clock get time] 0 9]);
:local fileName ([/system identity get name]."_".$date."_".$time.".rsc")
:local rsc $fileName