# Easy way to get directory names above Parent?

**URL:** https://community.mp3tag.de/t/easy-way-to-get-directory-names-above-parent/9324
**Category:** General Discussion
**Created:** [November 12, 2009, 7:20pm UTC](https://community.mp3tag.de/t/easy-way-to-get-directory-names-above-parent/9324 "2009-11-12T19:20:01Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![tjwhale](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/a9adbd/32.png) [@tjwhale](https://community.mp3tag.de/u/tjwhale)
#### Post date: [November 12, 2009, 7:20pm UTC](https://community.mp3tag.de/t/easy-way-to-get-directory-names-above-parent/9324/1 "2009-11-12T19:20:01Z")

</div>

Hi,

I've been using mp3tag for a while, and very much love it! Especially after updating recently and finding the few annoyances I'd lived with had gone away. Yesterday I discovered 'Actions' and decided to try my hand at further automating my file tagging. I've got most of what I want working, but I'm wondering if there is an easy way to get the directory name that is one above \_Parent\_Directory? I save files in the following formats:

 

%artist%\%album%\%track% - %title%  
%artist%\%year% - %album%\%track% - %title%  
%artist%\%album% [nCD]\CDn\%track% - %title%  
%artist%\%album% [nnCD]\CDnn\%track% - %title%  
%artist%\%year% - %album% [nnCD]\CDnn (subalbum title)\%track% - %title%

 

and so on, using CD1, CD2 etc for multiple disk albums.

 

So sometimes I want to get the artist from the second directory back (which I get with \_Parent\_Directory), and sometimes the third. Is there an easier way than... Come to think of it, how can I search from the right for the correct occurrance of ""?

 

If this is not so easy, then I'll make a suggestion for a function that would return the x higher directory ![:music:](https://community.mp3tag.de/uploads/default/original/1X/2ba05d1ade5eb0d15fc173be6f717dbe63890a70.gif ":music:")

 

Thanks for any help. Mp3tag is really a great piece of software! I used to follow the Vim development when I used it at work, and now I have a substitute obsession for home ![:sorcerer:](https://community.mp3tag.de/uploads/default/original/1X/73535d0e07591636841ac7aadccc8f7ff56e7807.gif ":sorcerer:")

 

Terry

---

_[View the full topic](https://community.mp3tag.de/t/easy-way-to-get-directory-names-above-parent/9324)._
