getFilePathLevel
Requires a Node.js runtime ('qsu/node')Determine how many steps the current path is. The root path (/ or C:\) begins with step 1.
A trailing separator is ignored, so /home/user/ and /home/user report the same level.
Parameters
| Name | Type | Required | Default |
|---|---|---|---|
filePath | stringStringstr | ● | – |
Returns
number
int
Examples
javascript
// Include 'C:\' root path
getFilePathLevel('C:\\Windows\\System32'); // 3
// Include '/' root path
getFilePathLevel('/home/user'); // 3
// A trailing separator does not add a level
getFilePathLevel('/home/user/'); // 3dart
// Include 'C:\' root path
getFilePathLevel('C:\\Windows\\System32'); // 3
// Include '/' root path
getFilePathLevel('/home/user'); // 3
// A trailing separator does not add a level
getFilePathLevel('/home/user/'); // 3python
# Include 'C:\' root path
getFilePathLevel('C:\\Windows\\System32') # 3
# Include '/' root path
getFilePathLevel('/home/user') # 3
# A trailing separator does not add a level
getFilePathLevel('/home/user/') # 3