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.
How would I get the path depth from this to use in a simple conditional in a button on the order of: If pathdepth = 1 then display a message? I'm interested in how to do the if clause. Can I do this without the column being displayed? Thanks for any help.
@lxp As always, thanks for posting helpful scripts! Looking at path depth from the opposite angle, how might one calculate depth from the current directory to component(s) within the deepest subfolder?
If you already have the deepest subfolder it's basic calculus. Finding the deepest subfolder is a bit trickier. Are you looking for the absolute deepest subfolder or the first folder that doesn't contain another folder?
You would need to completely enumerate F3, get the path depth of all folders, and keep the folder with the maximum number. Certainly doable, but displaying the results in columns might get a bit slow on large HDDs with a big folder tree.