Delete individual pages and layers by command line

Build 1501 on 14/Nov/2017  This topic last edited on: 13/Jan/2016, at 11:33

It is possible to delete pages and layers in a single operation, by means of the command to execute in the Command prompt window from the folder where GN4 resides (all in one line):

cmd4 
  spike 
  -ids XXX,YYY,ZZZ 
  -unref pageLayer.pages,linkObject.pageLayers.pageRef,linkObject.pageLayers.layerRef,txtGeometry.jumps 
  -purge 0 
  -username xxxx
  -password yyyy

where xxxx is the name of a GN4 user who can logon to system with sufficient permissions to perform this operation and yyyy is the password.

Note: the above connects to the default connection: should you want to specify the connection or server name, see cmd4 examples.

The above command deletes the page/layers with the specified ids (XXX, YYY, ZZZ etc) unlinking all the images, texts and articles and also unlinking the layers being deleted from pages not being deleted (shared layers).

The '-purge 0' option cause the page/layers to be immediately purged at the next cleanup. It is suggested because pages and layers deleted in this cannot really be undeleted: they have lost all their links - so it is better to purge them as soon as possible.

CAVEAT: if page/layers are deleted in this way, and then the whole edition is deleted, attempts to undelete it before the page/layers have been purged will probably fail with key conflicts, because the edition undelete will try to undelete also the page/layers that have been deleted individually. There should be way to purge the page/layers immediately.

See also

Delete or undelete editions

Undeleting editions by command line