1

If I use the following terminal command:

Mediainfo --Language=raw --Full '--Inform=General;%FileSize_String4%' '/Volumes/New Volume//FILM/test.avi'

I receive this output, which is what I want:

701.5 MiB

When I run this bash script in OS X:

find "$1" -name "*.avi" -o -name "*.AVI"| (

while IFS= read -r file; do

    vsize=($(Mediainfo --Language=raw --Full --Inform=General\;\%FileSize_String4\% "$file"))
    echo "$file","$vsize" >> /Users/me/fileaudit.csv 
done
)

I receive this output (the MiB/Gib etc is stripped):

701.5

What am I doing wrong?

Tandy Freeman
  • 528
  • 5
  • 15

1 Answers1

1

I think you need to remove the outer parentheses where you assign the value to your variable size, so it looks like this:

vsize=$(Mediainfo --Language=raw --Full --Inform=General\;\%FileSize_String4\% "$file")

By the way, you can also get the file size in bytes of a file on OSX with:

stat -f "%z" someFile
Mark Setchell
  • 191,897
  • 31
  • 273
  • 432