Segmentation questions

In my func:

q.Sync("SaveSegment:{[SegmentName;hdbdir]\r\n" + "SegmentPath: sv (hdbdir;dbdata;SegmentName);\r\n" + "if[((.Q.P?SegmentPath)=(count .Q.P))=1b;ParPath: sv (hdbdir;dbhead;par.txt); file: hopen ParPath; file (SymbolPathToString SegmentPath), "\n";hclose file]};");`
I’m checking that my segment not exist in .Q.P, but when DB is empty, there is not .Q.P and I got error.

How can I check this?

For usual variables, I can check them by (system"v")?`foo, but .Q.P isn’t system variable…

It strange but 

\l .
works alright and

system"l" .
not works, I receive: 

.,["\\"].["l"]
and my \cd:

"c:\\db\\db2.5\\dbhead"

PS how can I reload my DB by other way?
I know path but don’t know how convert symbol/string to directory type.

everything must be in a string for the system command to execute…

system"l ", string PATH

@[{system"l ",string x};PATH;`error]

value "\l ",string PATH

http://code.kx.com/wiki/Reference/SystemCommands#.5Cl\_name\_-\_load\_file\_or\_directory

http://code.kx.com/wiki/Reference/SystemCommands#System\_Commands

http://code.kx.com/wiki/Startingkdbplus/hdb#5.3\_Sample\_Segmented\_Database

HTH,

Sean

Thanks, it helps.
system"l “,system"cd”