Skip to content


Delete a file or folder

Syntax: hdel x, hdel[x]

Where x is a file symbol, deletes the file or folder.

q)hdel`:test.txt   / delete test.txt in current working directory
q)hdel`:test.txt   / should generate an error
'test.txt: No such file or directory

hdel can delete folders only if empty.

To delete a folder and its contents, recursively

​/diR gets recursive dir listing​
q)diR:{$[11h=type d:key x;raze x,.z.s each\` sv/:x,/:d;d]}
​/hide power behind nuke​
q)​nuke:hdel​ ​each​ ​​desc diR​@​ / desc sort!​

For a general visitor pattern with hdel

​q)visitNode:{if[11h=type d:key y;.z.s[x]each` sv/:y,/:d;];x y}

Deleting a column from a splayed table on Windows

Unlike Linux, Windows doesn’t allow one to overwrite files which are memory mapped, and it takes some mS after unmapping for that to become possible.

File system