Quickest way to backup routines

Primary tabs

Caché, Terminal, Backup

I have found this one line command from the Terminal is the quickest way to backup my routines.

In the Namespace the routines reside:

w $SYSTEM.OBJ.Export("MYRTNS*.MAC","C:\Users\Username\Desktop\MYRTNS.BCK-9-2-2016-8AM")


Hi Mike,

I like your idea. However, you could get an automatic time stamp in your filename by using the $zdatetime() function. Also, I would recommend using the standard ".xml" extension on the file, since the resulting file is not actually a Cache backup file, but an export of code in XML format, similar to what you get using the Studio export option.

The following command gives you the current timestamp as part of the filename:

w $SYSTEM.OBJ.Export("MYRTNS*.MAC","C:\Users\jsinnamo\Documents\MYRTNS_"_$tr($zdatetime($h,3)," :","_")_".xml")

You can play with the second argument of the $zdatetime() function to vary the date format. Also note that I used the $translate() function to change spaces to underscores ( _ ) and also to remove colons ( : ) from the time value, since colons are invalid characters in a Windows filename. My resulting file was



Best regards,


InterSystems support