# Compare TOTALTRACKS to number of files in folder

**URL:** https://community.mp3tag.de/t/compare-totaltracks-to-number-of-files-in-folder/15038
**Category:** General Discussion
**Created:** [September 15, 2013, 10:25am UTC](https://community.mp3tag.de/t/compare-totaltracks-to-number-of-files-in-folder/15038 "2013-09-15T10:25:11Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Ydope](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/y/6f9a4e/32.png) [@Ydope](https://community.mp3tag.de/u/Ydope)
#### Post date: [September 15, 2013, 10:25am UTC](https://community.mp3tag.de/t/compare-totaltracks-to-number-of-files-in-folder/15038/1 "2013-09-15T10:25:11Z")

</div>

Hi,

is there some way to compare the number of mp3 files in a folder to the content of %totaltracks% of any of the mp3 files within the folder?  
I'm currently revamping my collection and the first step i'd like to do is to seperate folders with too many/few mp3s.  
If they don't match some kind of marking would be useful - e.g. in the form of an extra tag like %totaltracksdisparity% = 1 or in form of some string added to the folder name. Ideally this could be done for a large number of folders at once.

Ideas?

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [September 15, 2013, 12:13pm UTC](https://community.mp3tag.de/t/compare-totaltracks-to-number-of-files-in-folder/15038/2 "2013-09-15T12:13:51Z")

</div>

I do not quite know where the data for comparison should come from. have you filled all totaltracks fields?

Now, what I could think of:  
as there is no function within MP3tag except the track numbering wizard that knows anything about folders and total numbers, I can only think of using this wizard to find out the actual number.

But first: save the current track number to a user-defined field  
Then start the numbering wizard to let it renumber each folder.  
Now compare (with a filter) the old track number in the user-defined field with the newly generated track number. If they do not match then you have a gap somewhere in the files list in that folder/album.

Whe you are done, you can copy back the old track number from the user-defined field

---

<div class="post-metadata">

### Author: ![Ydope](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/y/6f9a4e/32.png) [@Ydope](https://community.mp3tag.de/u/Ydope)
#### Post date: [September 15, 2013, 1:10pm UTC](https://community.mp3tag.de/t/compare-totaltracks-to-number-of-files-in-folder/15038/3 "2013-09-15T13:10:25Z")

</div>

> [@ohrenkino](#):
>
> I do not quite know where the data for comparison should come from. have you filled all totaltracks fields?

Yeah, in all cases I have the correct number of tracks stored in the TOTALTRACKS tag. At least that's how foobar calls the tag. In Mp3tag I access it via reading the number that comes after the character "/" in TRACK, to get i.e. the "20" in "07/20". So it looks like that: $right(%TRACK%,$sub($len(%TRACK%),$strchr(%TRACK%,/)))

Anyway, your idea of copying the original contents and using the wizard is working, thanks!
