SyncFileLinks Example

This example compares the cms root item with code FS_MIRROR to the folder indexedcontent (relative path to the www) on disc.

If the cms folder doesn't completely mirror the files and (sub)folder(s) on disc, the syncfilelinks macro will generate an Import xml file and will return true.

After importing this file (using e.g. webservice call to the Asynchronous Import module), the cms folder will exactly mirror the folder on disc.

Smartsite SXML CopyCode image Copy Code
{buffer.set(guid, "SYNCFILELINKS_"+string.toupper(sys.newguid(N)))}    
{buffer.set(filename,"../system/import/facetedsearch/"+$guid+".xml")}

<se:syncfilelinks
        filename="{buffer.get(filename)}"
        item="FS_MIRROR"
        location="indexedcontent"
        contenttypecodefolders="WP"
        save="result">
    <se:parameters>
        <se:parameter name="fileexclusionexpressions">
            <se:collection>
                <se:member>^.*\.(db|zip|dll|exe|config)$</se:member>
            </se:collection>
        </se:parameter>
    </se:parameters>
</se:syncfilelinks>