Get combined size of all files in folder?

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
RNIB
Macro Veteran
Posts: 195
Joined: Thu Jan 10, 2008 10:25 am
Location: London, UK

Get combined size of all files in folder?

Post by RNIB » Tue Sep 19, 2017 3:54 pm

I would like to add a final function to my macro. This macro joins together several WAV files into one new file.

What I would like to do is to get the file size of the newly created file (1 wav file) and compare it against the combined file size of all the WAV files that were joined together. All of those WAV files would be in a known folder but that will contain other file types so it needs to only count .wav files.

I know that they probably won't match exactly but if I could build in some tolerance like +/- 2% then that would be acceptable.

I know you can use FileSize which I could loop and then add together but just wondering if there was a simpler way of doing it as there will be lots of files to add up individually.

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: Get combined size of all files in folder?

Post by JRL » Tue Sep 19, 2017 4:19 pm

I know you can use FileSize which I could loop and then add together...
And that's how you would do it. At some level no matter how you get your answer that is what is happening.

Code: Select all

GetFileList>Path\*.wav,vList,;
Separate>vList,;,vFile

Let>vFileSizeTotal=0
Let>kk=0
Repeat>kk
  Add>kk,1
  Let>value=vFile_%kk%
  FileSize>value,vSize
  Add>vFileSizeTotal,%vSize%
Until>kk=vFile_Count

MDL>vFileSizeTotal

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts