Unsolved
This post is more than 5 years old
4 Posts
0
1352
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
Jeffey1
2 Intern
2 Intern
•
2.8K Posts
1
December 1st, 2014 20:00
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
93 Posts
0
December 2nd, 2014 12:00
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
114 Posts
1
December 2nd, 2014 14:00
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
4 Posts
0
December 10th, 2014 01:00
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 bhalilov@un 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