MWigger
1 Copper

API questions

Hello,

I am currently writing a script and have 2 questons regarding folders:

Is it possible to get the size of a folder via API (I mean complete size of all files and this folder)

And is there an elegant way to just check if an folder exists

(Currently I make an try catch arround a GET request, but this looks nasty to me)

Best regards, Marius

Tags (2)
0 Kudos
4 Replies
Highlighted
Jeffey1
4 Germanium

Re: API questions

Hi Mwigger,

Please consider moving this question as-is (no need to recreate) to the proper forum for maximum visibility.  Questions written to the users' own "Discussions" space don't get the same amount of attention and questions can go unanswered for a long time.

You can do so by selecting "Move" under ACTIONS along the upper-right.  Then search for and select: "Isilon" which would be the most relevant for this question.

mattashton1
2 Iron

Re: API questions


Hi Mwigger,

Have you fooled around with the latest API (7.2)?

For a directory /ifs/data/matt:

ma-visi-72-1# curl -u root:a -k 'https://191.1.2.3:8080/namespace/ifs/data/matt?detail=size'

{"children":[{

  "name" : "thisisifsdatamatt.txt",

  "size" : 29

}

,{

  "name" : "foo",

  "size" : 58

}

ma-visi-72-1#

This gives you the size of the files contained within.  Though it looks like you'll have to programmatically sum them.

I haven't seen an elegant way of determining if a folder exists... 

Cheers,
Matt

bhalilov1
2 Iron

Re: API questions

If you need the size of the directory and all of  it's content ( subdirectories included)  you can query the sqlite3 database that FSanalize job creates. I'm not sure if you need InsightIQ  to be able to schedule the FSanalyze jobs :

ptc-3# sqlite3 /ifs/.ifsvar/modules/fsa/pub/latest/results.db 'select system_squash_map.path , disk_usage.phys_size_sum /1024  from system_squash_map  join disk_usage on system_squash_map.lin = disk_usage.lin  where system_squash_map.path like "%big%"  ;'

dm/bigdir|486389

dm/samebigdir|486341

dm/big1|486341

dm/verybig|486365

MWigger
1 Copper

Re: API questions

Hello,

the answer of mattashon seems to ge the right direction, the only thing missing is some recursive function I did not find yet.

The answer from is nice as well, but I search for a clientsside solution without ssh access

So, did anyone find an legant way to do so via api or via python backend?

Best regards,

Marius

0 Kudos