# Determine the last loop inside loop?

**URL:** https://community.mp3tag.de/t/determine-the-last-loop-inside-loop/7231
**Category:** Export
**Created:** [September 23, 2008, 7:26am UTC](https://community.mp3tag.de/t/determine-the-last-loop-inside-loop/7231 "2008-09-23T07:26:10Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [March 1, 2014, 4:47pm UTC](https://community.mp3tag.de/t/determine-the-last-loop-inside-loop/7231/5 "2014-03-01T16:47:56Z")

</div>

QUOTE (LosMintos @ Sep 23 2008, 10:26) \<{POST\_SNAPBACK}\>

... I'm trying to execute a command only in the last loop, e.g.

```
$loop(%_filename_ext%) 
  $num(%track%,2) -- %title%
  IF this is the very last run of this loop, than do ... else nothing.
$loopend

```

... (By the way, it was easy to determine the first loop: $if($eql(%\_counter%,1),true,false).  
Any help is appreciated. Regards, LosMintos

  
Better late than never ... here is an example export script ... **$filename($getEnv('USERPROFILE')'\Desktop\Export.Whatever.txt',UTF-8) $loop(%\_path%)$puts(CountMax,%\_counter%)$loopend() $loop(%\_path%) 'Item: '%\_counter%$if($eql($get(CountMax),%\_counter%),' \<-- Here is the last item.',) 'Path: '%\_path% $loopend()**

Example output ...

```
Item: 1
Path: T:\TEST\File 01.mp3

Item: 2
Path: T:\TEST\File 02.mp3

Item: 3 <-- Here is the last item.
Path: T:\TEST\File 03.mp3

```

DD.20140301.1847.CET

---

_[View the full topic](https://community.mp3tag.de/t/determine-the-last-loop-inside-loop/7231)._
