# \[X\] %\_total\_files% fails

**URL:** https://community.mp3tag.de/t/x-total-files-fails/9008
**Category:** No Bugs
**Created:** [September 22, 2009, 5:40pm UTC](https://community.mp3tag.de/t/x-total-files-fails/9008 "2009-09-22T17:40:14Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [September 22, 2009, 5:40pm UTC](https://community.mp3tag.de/t/x-total-files-fails/9008/1 "2009-09-22T17:40:14Z")

</div>

1 See that file:///C:/Program%20Files/Mp3tag/help/options\_export.html#placeholder says

> [@](#):
>
> Global placeholders (calculated per loop)  
> %\_total\_files% Total number of files

2 Select five tracks  
3 Run this export script

```
$loop(%dummy%)%_total_files% $loopend()

```

Expected: 5 5 5 5 5  
Observed: 5 4 3 2 1

Anyone know a workaround? The loop-broken $puts/$get need not apply.

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [September 22, 2009, 5:50pm UTC](https://community.mp3tag.de/t/x-total-files-fails/9008/2 "2009-09-22T17:50:48Z")

</div>

> Anyone know a workaround?

```
$loop(%dummy%)$sub($add(%_counter%,%_total_files%),1) $loopend()

```

---

<div class="post-metadata">

### Author: ![newser](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/n/b9bd4f/32.png) [@newser](https://community.mp3tag.de/u/newser)
#### Post date: [September 23, 2009, 8:30am UTC](https://community.mp3tag.de/t/x-total-files-fails/9008/3 "2009-09-23T08:30:27Z")

</div>

> [@chrisjj](#):
>
> Expected: 5 5 5 5 5
> 
> ...
> 
> > Anyone know a workaround?

```
$repeat(%_total_files% ,%_total_files%)

```

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [September 23, 2009, 10:14am UTC](https://community.mp3tag.de/t/x-total-files-fails/9008/4 "2009-09-23T10:14:39Z")

</div>

> [@newser](#):
>
> $repeat(%\_total\_files% ,%\_total\_files%)

Thanks, but doesn't work here.

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [September 25, 2009, 10:05am UTC](https://community.mp3tag.de/t/x-total-files-fails/9008/5 "2009-09-25T10:05:01Z")

</div>

Global placeholders are calculated by $loop and, thus, only available outside of that loop.

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [October 1, 2009, 10:04pm UTC](https://community.mp3tag.de/t/x-total-files-fails/9008/6 "2009-10-01T22:04:47Z")

</div>

OK, thanks...

... but that does not accord with the Help, especially since the Help says Global.

May I suggest the Help be fixed, e.g.:

Global placeholders (providing totals for the preceeding $loop/$loopend)

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [December 14, 2009, 11:09am UTC](https://community.mp3tag.de/t/x-total-files-fails/9008/7 "2009-12-14T11:09:13Z")

</div>

> Anyone know a workaround?

I found this workaround:

```
$loop(%dummy%)
$puts(fixedtotalfiles,$sub($add(%_counter%,%_total_files%),1))
... %fixedtotalfiles% ...
$loopend()

```

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [December 28, 2018, 2:26pm UTC](https://community.mp3tag.de/t/x-total-files-fails/9008/8 "2018-12-28T14:26:39Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
