New paramater for 'get' . . . ? (file size needed!)

Features wanted...
Post Reply
Biggynuff
Posts: 110
Joined: 13 May 2010 14:08

New paramater for 'get' . . . ? (file size needed!)

Post by Biggynuff »

Hi Don and fellow XYers 8)

Not sure if this currently exists, but is there a script command that can return the file size of a selected file in the list? I've looked at 'get' etc but there doesn't seem to be a parameter to obtain this

What I'd like to do is look at writing a simple script that takes all items selected on the list and copies their file size (in whatever display units) to the comment field

This would be quite useful at times, as having XY display the file sizes each time a certain folder is opened can take a while, and they disappear when I look elsewhere in that tab :lol:

No worries if this isn't possible. But I bet it already is and many of you are now laughing at how stupid I am :roll:

Thanks!

Biggy

Biggynuff
Posts: 110
Joined: 13 May 2010 14:08

Re: New paramater for 'get' . . . ? (file size needed!)

Post by Biggynuff »

Solved!

I am humbled by XY. Yet again 8)

Spent ages thinking about this, then the 'property' command jumped straight into my brain. Incredible Don :lol: Now I just need to work out how to display the size (returned as bytes) to mb or gb as appropriate and I'm there

Or rather, a bit closer before I become overcome with scripting mental health syndrome and ask for more help :P

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: New paramater for 'get' . . . ? (file size needed!)

Post by Stefan »

Biggynuff wrote:Solved!
the 'property' command
or
Scripting Commands Reference > report()
{Size KB} KB
{Size B} Bytes (no suffix)
{Size RAW} Raw bytes (no thousand separators)
{Size MB} MB
{Size GB}

or
User Menu Commands > <cursize>
Now I just need to work out how to display the size (returned as bytes) to mb or gb as appropriate and I'm there
formatbytes()
http://www.xyplorer.com/xyfc/viewtopic. ... 530#p54530

admin
Site Admin
Posts: 64620
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: New paramater for 'get' . . . ? (file size needed!)

Post by admin »

Both retrieve the size for the current file:

Code: Select all

text report("{Size KB}",1);
text formatbytes(property("Size"), "KB");
report() should be a little faster than property()

Biggynuff
Posts: 110
Joined: 13 May 2010 14:08

Re: New paramater for 'get' . . . ? (file size needed!)

Post by Biggynuff »

Now, here's a thing . . .

Why, why, WHY? :shock: did I know when I posted that question that, not only would XY be able to do what I wanted, but be able to do if far better than I had imagined

You guys are just awesome 8)

Thank you very much, always appreciated

Biggy

Post Reply