cancel
Showing results for 
Search instead for 
Did you mean: 

Q for Mortals section 1.21

PTECH127
New Contributor II

What is the function for deleting previously created files in the q command line?

1 ACCEPTED SOLUTION

eteague
New Contributor II

Just following up in on this, there is a keyword for this hdel - here is more info and usage examples for it:
hdel deletes a file or folder | reference | q and kdb+ documentation - Kdb+ and q documentation (kx....

View solution in original post

3 REPLIES 3

PTECH127
New Contributor II

q shell.PNG

eteague
New Contributor II

For deleting a previously created file, I don't think q has an keyword/operator for that. However you can use the system keyword to execute a system command (see more here - (system keyword executes a system command | Reference | kdb+ and q documentation - Kdb+ and q documen...)

So for your example of deleting a file here's a quick example. In the first line I'm writing some text to a file test.txt in a directory test and the following line I use a system command to delete it

 

q)`:test/test.txt 0: enlist "text to save"
`:test/test.txt
q)system"del test\\test.txt"

eteague
New Contributor II

Just following up in on this, there is a keyword for this hdel - here is more info and usage examples for it:
hdel deletes a file or folder | reference | q and kdb+ documentation - Kdb+ and q documentation (kx....