Skip to main content
gregreser
Legend
July 25, 2011
Question

Get file size value for export to .txt

  • July 25, 2011
  • 2 replies
  • 816 views

I have created a script to export metadata using the XMP Script Library.  I am able to get all the properties I need except one: image file size (not dimensions, but the size of the file itself in MB).  File size is not included in any XMP namespaces and it isn't in any TIFF tags as far as I can tell.

Getting the file name is very straightforward: exportFile.write (thumb.name), but I can't find any method to get the file size.

Any ideas would be a big help.

Thanks in advance,

Greg Reser

This topic has been closed for replies.

2 replies

gregreser
gregreserAuthor
Legend
July 26, 2011

Paul and Mark,

Thank you!  Both methods work perfectly!

Greg

Paul Riggott
Inspiring
July 25, 2011


var sels = app.document.selections;
alert(sels[0].spec.length);


This will get you the file size in bytes, then you can divide to get Mbytes.

Inspiring
July 25, 2011

or…

var sels = app.document.selections;
alert( sels[0].core.immediate.size );