Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Finding music library folder's name (Read 918 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Finding music library folder's name

I'm trying to find the name of the folder up several levels from the path of a file. This is what I have come up with...

$cut($substr(%path%,23,100),$sub($strchr($substr(%path%,23,100),\),1))


This finds the length needed to cut... $sub($strchr($substr(%path%,23,100),\),1)
from the path with the beginning cut off... $substr(%path%,23,100)
to give the path with the unwanted parts cut off to leave the name of the folder I want to find.


Is there a better way to find this folder name? ($directory(x,n) doesn't work that well because all the files have to have the same number of folders in their path)

 

Finding music library folder's name

Reply #1
I've managed to improve it. BTW, this can be added as a new entry for Facets...

Code: [Select]
$puts(FolderName,music)
$puts(FolderName,$trim($caps($get(FolderName))))
$puts(VAR,$directory_path(%path%))
$puts(VAR,$substr($get(VAR),$add($strstr($caps($get(VAR)),\$get(FolderName)),1),255))
$puts(VAR,$substr($get(VAR),$add($strchr($get(VAR),\),1),255))
$puts(VAR,$substr($get(VAR),1,$add($strchr($get(VAR),\),-1)))
$get(VAR)


It's made so you only have to edit the 1st line, assuming you have to edit it at all. You change the word "music" on this line to the name of the folder that your music is in.

You can delete the 2nd to last line and you get "Folder Paths". The name of every folder with the path to it (not including the first part of the path to the music library folder).