# %\_folder%?

**URL:** https://community.mp3tag.de/t/folder/1798
**Category:** General Discussion
**Created:** [March 21, 2005, 2:39am UTC](https://community.mp3tag.de/t/folder/1798 "2005-03-21T02:39:06Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Crayon](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/ecae2f/32.png) [@Crayon](https://community.mp3tag.de/u/Crayon)
#### Post date: [March 21, 2005, 2:39am UTC](https://community.mp3tag.de/t/folder/1798/1 "2005-03-21T02:39:06Z")

</div>

First of all, thanks for a great piece of software!! I haven't used it for long, but I can already see a lot of good functionality. 🙂

Now, to my question. Is there or will there be support for %\_folder%, just like there is for %\_filename%? In my searches I couldn't find anything mentioned about this previously.

My problem is this; I have a boat load of directories that end with "[catalog number]" (without quotes), to whose files I want to append the "[catalog number]" string to the comment field. I have found a solution that is a little cumbersome, and I think I would be able to achieve this much easier if there was a %\_folder% scripting variable. (Or, why not %\_folder% for immediate parent folder and %\_folders% for the full path, but I digress...)

My solution:

1. Perform a Filename - Filename conversion with the following settings:  
Old filename pattern: %1\%2  
New filename pattern: %2!!!$mid(%1,$strstr(%1,'['),$add(1,$sub($len(%1),$strstr(%1,'['))))

This renames the file(s) by appending three exclamation marks (!!!) followed by the catalog number in brackets to the end of the basename of the filename.

1. Perform a user defined action with the following settings:  
Action: Format value  
Field: "COMMENT"  
Formatstring: $iflonger(%comment%,0,%comment%. ,)$mid(%\_filename%,$add($strstr(%_filename%,'!!!['),3),_  
$sub($len(%\_filename%),$add($strstr(%\_filename%,'!!!['),2)))

This grabs the catalog number in brackets from the end of the filename and appends it to the end of the comment, inserting a period in between if no previous comment exists.

1. Perform a Filename - Filename conversion with the following settings:  
Old filename pattern: %1!!![%2  
New filename pattern: %1

This renames the file(s) to their original name. This all relies on the fact that none of my filenames or folders have three consecutive exclamation marks followed by an open bracket in them (!!![).

Is there a better solution than this and/or can we expect to see extra scripting variables in future releases?

---

<div class="post-metadata">

### Author: ![Sebastian\_Mares](https://community.mp3tag.de/user_avatar/community.mp3tag.de/sebastian_mares/32/9285_2.png) [@Sebastian\_Mares](https://community.mp3tag.de/u/Sebastian_Mares)
#### Post date: [March 21, 2005, 4:51am UTC](https://community.mp3tag.de/t/folder/1798/2 "2005-03-21T04:51:02Z")

</div>

Well, MP3Tag already contains some folder related variables. Check out the File name / path info export variables in the [help](https://docs.mp3tag.de/export).

> [@](#):
>
> %\_crc% CRC32 value of file content  
> %\_directory% Directory name  
> %\_extension% File extension without dot  
> %\_filename% File name without extension  
> %\_filename\_ext% File name with extension  
> %\_filename\_rel% Relative file name  
> %\_file\_mod\_date% Short modification date  
> %\_file\_mod\_datetime% Long modification date  
> %\_file\_size% File size in human readable format  
> %\_file\_size\_bytes% File size in bytes  
> %\_file\_size\_kb% File size in kilobytes  
> %\_file\_size\_mb% File size in megabytes  
> %\_path% File name with path  
> %\_folderpath% Path without file name  
> %\_folderpath\_rel% Relative path without file name  
> %\_volume% Volume label  
> %\_workingdir% Name of current working directory  
> %\_workingpath% Path of current working directory

---

<div class="post-metadata">

### Author: ![Crayon](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/ecae2f/32.png) [@Crayon](https://community.mp3tag.de/u/Crayon)
#### Post date: [March 21, 2005, 5:03am UTC](https://community.mp3tag.de/t/folder/1798/3 "2005-03-21T05:03:15Z")

</div>

> [@](#):
>
> Well, MP3Tag already contains some folder related variables. Check out the File name / path info export variables in the [help](https://docs.mp3tag.de/export).

Thanks for the prompt response! As I didn't check on the export stuff yet I hadn't realized that those variables existed and that they could also be used for the conversion actions. I'll give it a try! 🙂

EDIT: Yup, I needed only a modified version of step 2 above. Excellent!
