List size in bytes

Is it possible via the object model or web servecies to get the size of a list in bytes much like storman does?  The only issue with storman is that it will only display 100 lists and I have a site collection with thousands.  Any help would be
greatly appreciated.
Thanks,
Dan
Dan Marth

Hello Dan,
No direct class available in SP to get the size so you need to measure the each item size and then calculate them in byte. Refer this link:
http://rajeshagadi.blogspot.nl/2011/04/how-to-find-sharepoint-list-and.html
Hope it could help
Hemendra:Yesterday is just a memory,Tomorrow we may never see
Please remember to mark the replies as answers if they help and unmark them if they provide no help

Similar Messages

  • How to get the file size (in bytes) for all files in a directory?

    How to get the file size (in bytes) for all files in a directory?
    The following code does not work. isFile() does NOT recognize files as files but only as directories. Why?
    Furthermore the size is not retrieved correctly.
    How do I have to code it otherwise? Is there a way of not converting f-to-string-to-File again but iterate over all file objects instead?
    Thank you
    Peter
    java.io.File f = new java.io.File("D:/todo/");
    files = f.list();
    for (int i = 0; i < files.length; i++) {
    System.out.println("fn=" + files);
    if (new File(files[i]).isFile())
         System.out.println("file[" + i + "]=" + files[i] + " size=" + (new File(files[i])).length() ); }

    pstein wrote:
    ...The following code does not work. Work?! It does not even compile! Please consider posting code in the form of an SSCCE in future.
    Here is an SSCCE.
    import java.io.File;
    class ListFiles {
        public static void main(String[] args) {
            java.io.File f = new java.io.File("/media/disk");
            // provides only the file names, not the path/name!
            //String[] files = f.list();
            File[] files = f.listFiles();
            for (int i = 0; i < files.length; i++) {
                System.out.println("fn=" + files);
    if (files[i].isFile()) {
    System.out.println(
    "file[" +
    i +
    "]=" +
    files[i] +
    " size=" +
    (files[i]).length() );
    }Edit 1:
    Also, in future, when posting code, code snippets, HTML/XML or input/output, please use the code tags to retain the indentation and formatting.   To do that, select the code and click the CODE button seen on the Plain Text tab of the message posting form.  It took me longer to clean up that code and turn it into an SSCCE, than it took to +solve the problem.+
    Edited by: AndrewThompson64 on Jul 21, 2009 8:47 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Which is better ListIterator or Simple list.size() in for loop

    Hi everybody
    I have one scenario in which, I need to delete the duplicate values from the list (Note : Duplicate values are coming in sequence).
    I tried to approaches as follows
    1) Using ListIterator
    I iterated all values and if I found any duplicate then I called remove() method of Iterator.
    2) I made another ArrrayList object, and iterated the old list using size() and for loop, and if I found unique value then I added that value to the new ArrayList.
    I also created one test java file to find out the performance in both cases. But I am not pretty sure that this test is correct or not. Please suggest me which approach is correct.
    code For Test
    public class TestReadonly {
         public static void main(String[] args) {
              List list = new ArrayList();
              long beforeHeap = 0,afterHeap = 0;
              long beforeTime = 0,afterTime = 0;
              addElementsToList(list);
              Collections.sort(list);
              callGC();
              beforeHeap = Runtime.getRuntime().freeMemory();
              beforeTime = System.currentTimeMillis();
              System.out.println(" Before "+System.currentTimeMillis()+" List Size "+list.size()+" heap Size "+beforeHeap);
              new TestReadonly().deleteDuplicated1(list);
              afterHeap = Runtime.getRuntime().freeMemory();
              afterTime = System.currentTimeMillis();
              System.out.println(" After  "+System.currentTimeMillis()+" List Size "+list.size()+" heap Size "+afterHeap);
              System.out.println(" Time Differance "+(afterTime-beforeTime)+" Heap Differance "+(afterHeap-beforeHeap));
              list.clear();
              addElementsToList(list);
              Collections.sort(list);
              callGC();
              beforeHeap = Runtime.getRuntime().freeMemory();
              beforeTime = System.currentTimeMillis();
              System.out.println(" Before "+System.currentTimeMillis()+" List Size "+list.size()+" heap Size "+beforeHeap);
              list = new TestReadonly().deleteDuplicated2(list);
              afterHeap = Runtime.getRuntime().freeMemory();
              afterTime = System.currentTimeMillis();
              System.out.println(" After  "+System.currentTimeMillis()+" List Size "+list.size()+" heap Size "+afterHeap);
              System.out.println(" Time Differance "+(afterTime-beforeTime)+" Heap Differance "+(afterHeap-beforeHeap));
          * @param list
         private static void addElementsToList(List list) {
              for(int i=0;i<1000000;i++) {
                   list.add("List Object"+i);
              for(int i=0;i<10000;i++) {
                   list.add("List Object"+i);
         private static void callGC() {
              Runtime.getRuntime().gc();
              Runtime.getRuntime().gc();
              Runtime.getRuntime().gc();
              Runtime.getRuntime().gc();
              Runtime.getRuntime().gc();
         private void deleteDuplicated1(List employeeList) {
              String BLANK = "";
              String currentEmployeeNumber = null;
              String previousEmployeeNumber = null;
              ListIterator iterator = employeeList.listIterator();
              while (iterator.hasNext()) {
                   previousEmployeeNumber = currentEmployeeNumber;
                   currentEmployeeNumber = (String) iterator.next();
                   if ((currentEmployeeNumber.equals(previousEmployeeNumber))
                             || ((BLANK.equals(currentEmployeeNumber) && BLANK
                                       .equals(previousEmployeeNumber)))) {
                        iterator.remove();
         private List deleteDuplicated2(List employeeList) {
              String BLANK = "";
              String currentEmployeeNumber = null;
              String previousEmployeeNumber = null;
              List l1 = new ArrayList(employeeList.size());
              for (int i =0;i<employeeList.size();i++) {
                   previousEmployeeNumber = currentEmployeeNumber;
                   currentEmployeeNumber = (String) employeeList.get(i);
                   if (!(currentEmployeeNumber.equals(previousEmployeeNumber))
                             || ((BLANK.equals(currentEmployeeNumber) && BLANK
                                       .equals(previousEmployeeNumber)))) {
                        l1.add(currentEmployeeNumber);
              return l1;
    Output
    Before 1179384331873 List Size 1010000 heap Size 60739664
    After 1179384365545 List Size 1000000 heap Size 60737600
    Time Differance 33672 Heap Differance -2064
    Before 1179384367545 List Size 1010000 heap Size 60739584
    After 1179384367639 List Size 1000000 heap Size 56697504
    Time Differance 94 Heap Differance -4042080

    I think, you test is ok like that. Although I would have tested with two different applications, just to be shure that the heap is clean. You never know what gc() actually does.
    Still, your results show what is expected:
    Approach 1 (List iterator) takes virtually no extra memory, but takes a lot of time, since the list has to be rebuild after each remove.
    Approach 2 is much faster, but takes a lot of extra memory, since you need a "copy" of the original list.
    Basically, both approaches are valid. You have to decide depending on your requirements.
    Approach 1 can be optimized by using a LinkedList instead of an ArrayList. When you remove an element from an ArrayList, all following elements have to be shifted which takes a lot of time. A LinkedList should behave better.
    Finally, instead of searching for duplicates, consider to check for duplicates when filling the list or even use a Map.
    Tobias

  • Limit size (in byte) of SELECT-OPTIONS in WHERE clauses

    hi,
    as far as I know there is a limit size (in byte) for SELECT-OPTIONS used in WHERE clauses. Is it true? What is the limit? If the SELECT-OPTIONS is based on lifnr (character type, 10 long) is the following calculation valid?
    sign - 1 byte
    option - 2 bytes
    low - 10 bytes
    high - 10 bytes
    23 bytes all together for one line, is this valid?
    thanks
    ec

    Hi,
    Check this link..
    https://forums.sdn.sap.com/click.jspa?searchID=6896082&messageID=2891787
    Regards,
    Omkar.

  • Suggested list size  is limited  with 10 elements using autoSuggestBehavior

    Hi,
    I am using the autoSuggestBehavior with inputListOfValuesComponent. suggestedItems come from a ViewObject. When I type a any letter the suggested items list is always is limited with 10 items(event the suggested list is longer) and user must go to another page to see the rest. Is there a way to increase the suggested list size?
    Thanks in advance..

    With the latest release of Jdeveloper we have a new component with auto suggest, so you dont need to implement any kinda of listeners or javascrips.I have used it as below ;
    <af:inputListOfValues id="gittigiYerTitleId" searchDesc="Ara"
    popupTitle="Search and Select: #{bindings.ViewMisdt626_1.hints.GittigiYerTitle.label}"
    value="#{row.bindings.GittigiYerTitle.inputValue}"
    model="#{bindings.GittigiYerTitle.listOfValuesModel}"
    required="#{bindings.ViewMisdt626_1.hints.GittigiYerTitle.mandatory}"
    columns="#{bindings.ViewMisdt626_1.hints.GittigiYerTitle.displayWidth}"
    shortDesc="#{bindings.ViewMisdt626_1.hints.GittigiYerTitle.tooltip}"
    partialTriggers="selectGidisTuru"
    binding="#{backingBeanScope.backing_app_yeniEvrak.gittigiYerTitleId}">
    <f:validator binding="#{row.bindings.GittigiYerTitle.validator}"/>
    <af:autoSuggestBehavior suggestedItems="#{bindings.GittigiYerTitle.suggestedItems}"/>
    </af:inputListOfValues>
    Where the suggestedItems list comes from a view object. My problem here is when I type any criteria it offers me only the first 10 items for the rest I must go to the search page offered again by the component. This ussage is not being so friendly for the users. I thought that there must a setting for the size of the offered items list.

  • Determination of array size in bytes

    Dear forum users,
    I want to determine the size of an array subset in bytes.
    At the moment I try to do this as shown in my attached program: Simply said, I am reading in my data (example data can also be found in the attachment) and convert them into an array. From this array I am taking the subset I am interested in. This array subset is saved in a new file from which I determine the byte size with the “Get File Size.vi”.
    That are a lot of steps with file saving (deletion of the compulsory created new file not mentioned) just to get the byte size of this array subset.  And with this approach the file size (the byte size of my array subset) is unfortunately depending on the format with which I save the file (%.6f or similar), but I would need the byte size of this subarray as it would be in the original file (see my comment on the front panel).
    Therefore, I want to know if there is a better, simpler, quicker and correct way to get the byte size of a subarray.
    I would be very happy about every comment and help!
    Attachments:
    ByteSizeOfArraySubsetLV2011.vi ‏18 KB
    ByteSizeOfArraySubsetLV8_6.vi ‏15 KB
    ExampleData.txt ‏1114 KB

    Dear GerdW and smercurio_fc,
    Thanks a lot for your replies! Perhaps I should have mentioned that I need the size of my array (string…, I am confused now) in bytes because I want to use later in my program the “Set File Position.vi” (which needs an offset in bytes). With this vi I want to read in my data again but starting after the data which I have used in my array (I try to make bunches out of my file).
    Ok, the suggestion of GergW is a step forward, but it does not work correctly. I have modified my program a bit (see attachment), so that it gives back the file size of the original file and the length of the string after the file has been read in. Interestingly, the numbers are not the same. The same is also true for my subarray (and the string length is still dependent on the format with which I convert my array to a string).
    So once again asked: If I take from my original file lines 3 to 12, copy them in a new file and save this file, then I can read out the size of the file (191 bytes). How can I get the same number in LabVIEW after reading in the original file and taking the same subarray? I hope my question is clearer now (it is surely suffering a bit from my bad English. I am sorry!).
    I hope to hear from you again!
    Attachments:
    ByteSizeOfArraySubsetLV2011_2.vi ‏14 KB
    ByteSizeOfArraySubsetLV8_6_2.vi ‏11 KB

  • How to get folder size in bytes

    Hi all,
    Is there a easy way to get folder size in bytes?  I don't want to check each file in it and then add them up.
    Thanks for any help.
    Anne

    Years ago, I found my home PC was lacking disk space and could not exaplain where all of the space went.
    At the same time I was teaching myslef how to use the Picture control and Windows did not allow you to check the size of a folder and it sub-folders. So I used that situation to learn about the picture control and LV at the same time.
    It worked and ran but very slowly.
    Soon after Greg McKaskle was putting together the first version of "The Good The Bad and The Ugly" and was looking for fodder to beat up. I offered and he accepted. When the time came for the presentation, my code was chosen as "The bad" since I had not learned how to do a cluster sort at that time so I wrote my own version of a bubble sort (the VI presents a Pie Chart of disk usage and clcik on the sectors of the Pie Chart allowed you to drill down so I hd to sort by sizes).
    So why am I telling you this long boring story?
    That code is attached for you to look at laugh and tell me how dumb I was.
    Feel free to beat me up. It can't be any worse than the abuse I got from Greg (I felt like I was being raped).
    Have fun!
    Ben
    Code is probably 6 or thereabouts. "Disk_Utility" is top level. Remember this is an example of how NOT to code.
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction
    Attachments:
    DIsk_Pie_Utility.zip ‏162 KB

  • How to get image size in bytes

    i have to get image size in bytes and accessing image from the a folder
    Thanks in advance

    If it's going to be accessed as a file on the filesystem, you can use java.io.File.length() to get the size in bytes.
    In other situations...it depends on what you're doing.

  • Calculate the size(in bytes) that will be displayed to the console by command Write-Output

    Is there some way to check the size(in bytes) of the output that will be displayed to the console using Write-Output command. I want the console to display only the first 1024 bytes of the objects output.

    Hi Sachin,
    in that case let me add an example on how to read content from a file that may be or may not be a text file:
    $string = [System.Text.Encoding]::UTF8.GetString([System.IO.File]::ReadAllBytes("D:\example.txt"))
    Theoretically, the "Get-Content" cmdlet ought to do the same, however I have occasionally experienced different results.
    You can choose to not convert it to string and just print the bytes too (or choose another encoding of your preference). Remember, a single letter usually uses 2 bytes, thus reading the first 1024 bytes from a file you converted to text would mean printing
    the first 512 letters.
    Cheers,
    Fred
    There's no place like 127.0.0.1

  • Cluster size in bytes programatically

    Is there something that implements a C stype "sizeof" in labview? I need to call a dll and pass in a cluster value and it's size in bytes.
    Thanks
    Eugene

    If the cluster doesn't have variable length data (strings and arrays), flatten the cluster to string and get the string length.
    LabVIEW, C'est LabVIEW

  • How can I do sth like this ${requestScope.list.size} ?

    Hi, I have 2 attributes which I pass like this
    requsest.setAttribute("startPoint", 3);
    request.setAttribute("myList", myList);
    where myList is a ArrayList filld with objects. On jsp page I want to count 2 values first and last number:
    <c:set var="firstNumber" value="${requestScope.startPoint+1}"/> - this works fine.
    <c:set var="lastNumber" value="${requestScope.startPoint+requestScope.myList.size}"/> - this is impropper.
    How can I use as integer size of list which is passed as request attribute. Is this possible?
    I would appreciate any hepl.

    Hang on. For such things you can build your own EL functions - it is very easy and involves only 4 steps.
    1. Write a class containing a method (must be static) to calculate size of any list.
    [Put the class in /WEB-INF/classes, so your file will reside as /WEB-INF/classes/myfunctions/MyFunctions.class]
    package myfunctions;
    import java.util.List;
    public class MyFunctions{
         public static int getListSize(List list){
              return list==null?0:list.size();
    }2. In your taglib add an entry (in case you don't have already create one) for the EL function:
    [Say our taglib is mytags.tld in /WEB-INF]
    <taglib xmlns="http://java.sun.com/xml/ns/j2ee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
      http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
         version="2.0">
         <tlib-version>1.0</tlib-version>
         <short-name>MyTagLib</short-name>
         <function>
              <description>List Size</description>
              <name>size</name>
              <function-class>myfunctions.MyFunctions</function-class>
              <function-signature>int getListSize(java.util.List)</function-signature>
         </function>
    </taglib>3. Now in your JSP add following line to use your new EL function:
    <%@taglib uri="/WEB-INF/mytags.tld" prefix="mt"%>4. And use as:
    <input type=text value="${mt:size(requestScope.myList)}" />Note that there no issues using JSTL EL functions. My intention is to resolve your problem and at the same time to give you a glance how to write and use your own EL functions (might be useful in future).
    Thanks,
    Mrityunjoy

  • Error:  Debug Component exceeds maximum size (65535 bytes)

    Hi All,
    It would seem that I have come across a limitation in the CAP file format for Java Card 2.2.1. When I run the Sun 2.2.1 converter I get the following output:
    Converting oncard package
    Java Card 2.2.1 Class File Converter, Version 1.3
    Copyright 2003 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
    error:  Debug Component exceeds maximum size (65535 bytes).
    Cap file generation failed.
    conversion completed with 1 errors and 0 warnings.This also happens with JCDK 2.2.2. Is there any way around this limitation? I can instruct the compiler to not generate some of the debug output such as variable attributes, but this makes the debugger less than useful. I could not find anything in the JCVM spec for JC2.2.1 that mentions this limitation (I could have missed it very easily if it is there). Is this a limitation that will be lifted in new versions of the standard? This is tarting to be a bit of a problem as our code base has outgrown our development tools (no more debugger). Compiling and running without debug information works fine.
    Any information on this would be much appreciated.
    Cheers,
    Shane

    For those that are interested, I found this in the Java Card VM spec. u1 and u2 are 1 and 2 byte unsigned values respectively. It would appear that it is a limitation of the CAP file format. We have managed to work around this problem (parsing the debug component of the cap file was very informative) by shortening package names, reducing exception handling, and removing classes that we could do without.
    It looks like this is removed for JC3.0 Connected Edition does not have this issue as it does not have CAP files, but JC2.2.2 and JC3.0 Classic Edition have this same issue. It would be nice if there was a converter/debugger combination that removed this limitation. If anyone knows of such a combination, I am all ears! I know for a fact that JCOP does not :(
    Cheers,
    Shane
    *6.14 Debug Component*
    This section specifies the format for the Debug Component. The Debug Component contains all the metadata necessary for debugging a package on a suitably instrumented Java Card virtual machine. It is not required for executing Java Card programs in a non-debug environment.
    The Debug Component references the Class Component (Section 6.8 "Class Component”), Method Component (Section 6.9 "Method Component”), and Static Field Component (Section 6.10 "Static Field Component”). No components reference the Debug Component.
    The Debug Component is represented by the following structure:
    {code}
    debug_component {
    u1 tag
    u2 size
    u2 string_count
    utf8_info strings_table[string_count]
    u2 package_name_index
    u2 class_count
    class_debug_info classes[class_count]
    {code}
    The items in the debug_component structure are defined as follows:
    *tag* tag item has the value COMPONENT_Debug (12).
    *size* The number of bytes in the component, excluding the tag and size items. The value of size must be greater than zero.

  • List.size() and math?

    Hi All,
    I'm making a card game (War) and am trying to show the % of cards each player has. The following, and many variations are producing 0's?
    txtStory.append(Math.round(((RedDeck.size()+RedDeckWon.size())/52)*100));I've tried casting each piece to int, and using toString() all over to no avail.
    Displaying just the addition of list sizes does work... dividing that number by 52 should produce the %, right?
    Any thoughts?
    Thanks!
    MVP

    If x and y are ints, then x/y will be done using integer math.
    99 / 100 = 0
    What you want to do is cast at least one of x and y to a float. Or divide by 52.0.

  • List size of table spaces

    Hello,
    I would like to list the name and size of table spaces and also extend them if they are almost filled. Since I'm more familiar with T/SQL I would greatly appreciate your help

    SQL> select u.tblspc "TBLSPC", a.fbytes "ALLOC", u.ebytes USED, a.fbytes-u.ebytes UNUSED,
    2 (u.ebytes/a.fbytes)*100 USEDPCT
    3 from (select tablespace_name tblspc, sum(bytes) ebytes
    4 from sys.dba_extents
    5 group by tablespace_name) u,
    6 (select tablespace_name tblspc, sum(bytes) fbytes
    7 from sys.dba_data_files
    8 group by tablespace_name) a
    9 where u.tblspc = a.tblspc
    10 ;
    TBLSPC ALLOC USED UNUSED USEDPCT
    CARTEST_DATA 891289600 488701952 402587648 54,8308824
    CARTEST_IDX 83886080 46465024 37421056 55,390625
    CARTMPTEST_DATA 41943040 26935296 15007744 64,21875
    RBS 541065216 104857600 436207616 19,379845
    SYSTEM 471859200 373547008 98312192 79,1649306
    TEMP 209715200 58654720 151060480 27,96875
    6 rows selected.
    SQL>
    Joel P�rez

  • Urgent: How to find out the size in bytes of java object

    Hi Experts,
    We've a requirement that we need to find out the size of a java object at run time, is there a direct java API to get the size of a composite object in memory?
    Here is my requirement: We are adding string objects (which is an xml string of considerable size) into a List. After reaching certain size limit (lets say 5MB) of the list i need to put this data into DB as a CLOB. So every time I add a string object to the list, I need to see if the total size of the list exceeds the limit and if yes, flush the results into DB.
    I am not sure if java has a direct API for this, if not what is the beast way to do it, it s critical requirement for us.
    It would be really great if someone could help us out.
    Thank you,
    -Shibu.

    >
    We've a requirement that we need to find out the size of a java object at run time, is there a direct java API to get the size of a composite object in memory?
    Here is my requirement: We are adding string objects (which is an xml string of considerable size) into a List. After reaching certain size limit (lets say 5MB) of the list i need to put this data into DB as a CLOB. So every time I add a string object to the list, I need to see if the total size of the list exceeds the limit and if yes, flush the results into DB.
    I am not sure if java has a direct API for this, if not what is the beast way to do it, it s critical requirement for us.
    It would be really great if someone could help us out.
    >
    Could you explain your actual requirement a little more fully.
    1. Is each individual string a separate XML string? Or is it just a fragment? Why would you just concatenate them together into a CLOB? That won't produce valid XML and it won't let you easily separate the pieces again later. So provide a simple example showing some strings and how you need to manipulate them.
    2. Are you using these xml strings in Java at all? Or are you just loading them into the database?
    For example if you are just loading them into the database you don't need to create a list. Just create a CLOB in Java and append each string to the CLOB. Before you append each one you can check to see if the new string will put you over your length limit. If it will then you write the CLOB to the database, empty the CLOB and start appending again to the new clob instance.
    If you explain what you are really trying to do we might be able to suggest some better ways to do it.

Maybe you are looking for

  • SQL Error while creating data Owner certification in SRM 5.0.3

    Hi , In SRM 5.0.3, while creating data Owner certification by choosing data owner, I m getting the following error. database i upgraded and the migration script is also run. java.sql.SQLException: Violation of PRIMARY KEY constraint 'pk_id_attr_val_u

  • Flat file as a source - now more confused then before.

    Sorry to open this topic again - i just got confused to what needs to be done (i did read all of the posts on previous topic - honest!) got confused to who did what and how it needs to be done. it's hard to be stupid sometimes :( here is what i have:

  • Function module in BADI

    hi, have anyone worked with function module in BADI.if so plz let me know how how to do my current requirment is on that poits will be rewarded regards raj

  • Two dimension string array in teststand

    Hello, I want to pass a two dimension string array from a labWindows dll into Teststand. My labwindows dll: #define NR_columns 12 #define NR_rows  1200 #define NR_hight   1024 int__declspec(dllexport) __stdcall  sort( char pspec[NR_columns][NR_rows][

  • I got stuck with iMovie

    , rainbow weel is always spinning and I cannon do anything! any suggestion?