PathDepth (Display depth in folder hierarchy)

This script column PathDepth displays the depth of files and folders in the folder hierarchy. Items on the root level (e.g. in C:\) have level 1. Useful in filters and for sorting and grouping in Flatview.

function OnInit(initData) {
    initData.name = 'PathDepth';
    initData.version = '2022-11-03';
    initData.copyright = '';
    initData.url = 'https://resource.dopus.com/t/pathdepth-display-depth-in-folder-hierarchy/42681';
    initData.desc = 'Display path depth.';
    initData.default_enable = true;
    initData.min_version = '12.0';
}

function OnAddColumns(addColData) {
    var col = addColData.AddColumn();
    col.name = 'PathDepth';
    col.method = 'OnColumn';
    col.justify = 'right';
    col.type = 'number';
}

function OnColumn(scriptColData) {
    scriptColData.value = scriptColData.item.path.components;
}

ColumnPathDepth.js.txt


4 Likes

scriptColData.item.path.Split().count = scriptColData.item.path.components?

Yes. The property probably needs less computing power, which is always welcome. Thanks!

Super script and ideas. Thank You