Prefix all block names

Hello all,
I’d like to add a prefix to all block names in a file, either with custom string or the file name.
Could some one help give me some pointers in how to do that in python?
Many thanks

Something like this perhaps?

import rhinoscriptsyntax as rs

def AddPrefixToBlkNames():
    if not blk_names: return
    prefix=rs.StringBox("Prefix to add")
    if prefix is None: return
    for blk_name in blk_names: rs.RenameBlock(blk_name,prefix+blk_name)
AddPrefixToBlkNames() (302 Bytes)


Excellent - thanks!