Determine the source -- BufferedReader

I have start Java programming and one of the function that I need to make is a read(), which accept PrintStream and BufferedReader. In this function, it supposes to determine whether the BufferedReader is from a keyboard (system.in) or a file. Now, I wonder how do you know if BufferedReader is accepting a keyboard or a file?
public static void main (String [] args) throws Exception
BufferedReader kb = new BufferedReader(new InputStreamReader(System.in));
System.out.print("\nPlease enter a file name with extension: ");
String inFileName = kb.readLine();
BufferedReader br = new BufferedReader(
new InputStreamReader(
new FileInputStream(
     new File(inFileName))));
//Obviously I could send either one... kb or br;
Fraction.read(System.out, kb); //accept user input and print on monitor
Fraction.read(System.out, br); //accept file input and print on monitor
public static Fraction read(PrintStream ps, BufferedReader br) throws Exception
//What do I need to test whether br == file or keyboard?

Your code doesn't make much sense, though... why would you ever want to pass 'kb' to Fraction.read()? So that you can get use input rather than reading it from a file? That's all well and good, but your problem isn't determining the BufferedReader source, it's in distinguishing whether the user wants to use the keyboard or a file. Another odd thing about your code is that, there really isn't any reason to know the source of the BufferedReader data at all... whether you pass kb or br, the way you read stuff will be the same.
Try something more like:
1) Ask user for a file name.
2) If user doesn't enter a file name, then tell them to type whatever data they wan't processed and pass kb to Fraction.read().
3) If user does enter a file name, the pass br to Fraction.read().

Similar Messages

  • How to determine the source of Events triggered in a process chain

    Hi ,
      We have almost a 100 process chains, and of these approx 20-30 local process chains are triggered by events raised within other process chains.  These events are raised via BP_EVENT_RAISE using the ABAP process type.
    However, our problem is to identify the source of these event trigger - i.e. which process chain triggered this event ?
    Looking at SM64, the event history does not display the source for these events.
    Is there any table or program that we can use to determine the source of these events which are triggered.
    Any help is much appreciated and points awarded.
    thanks
    BK

    Hi,
    do check in the program /SSA/BWT . or TCODE - ST13 -- enter BW-TOOLS and execute. -- Choose Process chains and execute --- Select the date and time for which you want to see the process chains and execute again.
    This will give you the entire list of process chains triggered, status, timings(start, end, overall runtime). Once clicked on the process chains it will show you the steps in theprocess chains, data loaded in the data targets, source system, etc...
    hope it helps.

  • How to determine the source to where my saved photo (not taken by my iPhone camera) on whether what application or website did i got that photo? need to go to the source again, please help

    how to determine the source to where my saved photo (not taken by my iPhone camera) on whether what application or website did i got that photo? need to go to the source again, please help

    There is no way to trace the source of a saved photo.
    You might have some luck if you search through the Safari web site history available via the Bookmark icon.

  • Determining the source button of servlet

    im having problem determining the source button when the user click one of two button
    the source code as follows
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class write extends HttpServlet {
    boolean isBeingSent;
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, java.io.IOException {
    PrintWriter out = resp.getWriter();
    out.println("<html>");
    out.println("<head>");
    out.println("<title>");
    out.println("write");
    out.println("</title>");
    out.println("</head>");
    out.println("<body background = C:/tomcat/webapps/" +
    "mailconnect/images/write.bmp>");
    out.println("<font face = 'arial'>");
    out.println("<font face = 'arial'>");
    out.println("<br>");
    out.println("<br>");
    out.println("<form method=\"POST\">");
    out.println("&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp"+
    "&nbsp&nbsp<input type = 'text' name = \"receiver\""+
    " size = 40> ");
    out.println("&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp"+
    "&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp"+
    "&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp"+
    "&nbsp&nbsp&nbsp&nbsp<input type = 'text' name =\"subject\""
    + "size = 40>");
    out.println("<br>");
    out.println("<br>");
    out.println("</font>");
    out.println("<br>");
    out.println("<textarea name =\"message\" rows=20 cols=60> ");
    out.println("</textarea>");
    out.println("<br>");
    out.println("<br><input type = submit name = 'send' value ='send'");
    out.println("</form>");
    /*Supposedly this is the second button that can be clicked but i did not included it in the form tag*/
    out.println("<input type = submit name = 'saveasdraft' value ='save" +
    " as drafts'>");
    out.println("</font>");
    out.println("</body>");
    out.println("</html>");
    protected void doPost(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, java.io.IOException {
    /*i wish i could send this to beensaved servlet when the user clicks save as draft button*/
    RequestDispatcher rd = req.getRequestDispatcher("beensent");
    rd.forward(req,resp);
    if we cannot determine the source button is there a way that i can set the beingSent boolean variable if the user clicks the send button? how can i do so? thank you so much
    the send button

    When the page is submitted, it sends the name/value pair of the button that was clicked with it.
    I second the comment about this being better as a JSP. Using out.println in a servlet like this was the whole reason JSPs were invented in the first place.
    Anyway, given you have the following HTML
    <input type = submit name = 'send' value ='send'>;
    <input type = submit name = 'saveasdraft' value ='save as drafts'>
    // the following check in java code can be made
    boolean sendButton = request.getParameter("send") != null;
    boolean saveasdraftButton = request.getParameter("saveasdraft") != null;Cheers,
    evnafets

  • How to determine the source of a Data Source

    How do you determine what the source is for a given Data Source? We are working with 0BP_RELATIONS_ATTR, which is a data source in the BI source system. However, we cannot figure out how to determine what the source is for this data source.

    Hi David,
    Have you seen this excellent blog by Roberto Negro : /people/sap.user72/blog/2005/09/05/sap-bw-and-business-content-datasources-in-pursuit-of-the-origins
    Hope this helps...

  • Determine the source server in RFC calls

    Hi All,
    is there any posibillity to find out what is the source server of an RFC function call inside the FM and if it's an qRFC what is the queue name.
    Thanks Thomas

    For the non-qRFC scenario you may want to try:
      CALL FUNCTION 'RFC_SYSTEM_INFO' DESTINATION 'BACK'
        IMPORTING
          rfcsi_export          = rfcsi_export
          rfc_login_complete    = rfc_login_complete
          dialog_user_type      = dialog_user_type
          current_resources     = current_resources
          maximal_resources     = maximal_resources
          recommended_delay     = recommended_delay
        EXCEPTIONS
          communication_failure = 1  MESSAGE dest_communication_message
          system_failure        = 2  MESSAGE dest_system_message.
    The RFCSI_EXPORT parameter will give you a few details of the calling system (host, sysid, etc...).

  • How to determine the source of text

    hi ,
    i have created  the standard text in so10.
    During creation of a sales order it is appearing  fine .
    But the problem is,
                           how can we know that from where the text is coming as i forgot the text name.
                           I also tried to enter the text in the text field in so10 but no vain.
                           Please help me in this issue.

    Hi Srikanth,
    You can find all the texts that were created in table STXH.
    There give the inputs like created by or the date range that these text were created and execute the table. You will find all the text created by the given user or between a date range.
    Hope that solves your problem.
    Regards,
    Swami

  • Using Firefox 3.6, how do I determine the souce of a view of my business website?

    I have a website, hosted by Earthlink. I employ Firefox 3.6 for viewing my website. Is their a way to use Firefox to determine the source of views of my website?
    Thank you.
    johnfogelman

    Right-click the page and select '''View Page Source'''.

  • How do I map the source file name to a target table?

    I am mapping a source fixed length flat file to oracle target tables. One of the tables is a parent transaction table that stores the date, record number, status, etc. and the file name of the source flat file. The file name will change daily because the date is part of the naming convention. Is there an easy way to determine the source file name and map it?
    One option a co-worker is working on is writing a pre-mapping stored procedure. It would insert the file name into a table prior to the mapping. But I was hoping for a cleaner solution.
    Thanks!

    Hi
    Use extarnel table to load the data from the file into the table.
    Create a procedure which changes the external table definition as the filename chnages.
    Use this proceudre in the mapping as a premapping process.
    Ott Karesz
    http://www.trendo-kft.hu

  • How to  determine the Person who Rejected the SC item in Sourcing

    Hi Experts,
    We are working in SRM 7.0 ERP 6.0 EHP 4 in a classic Scenario.
    We are creating free text SC without Supplier and on approval the Shopping carts are getting into Sourcing Queue.
    In Carry out Sourcing the Purchaser is selecting the SC item and rejecting some items.
    How can we determine the person who is rejecting the item in the Sourcing cockpit
    Thanks
    Pooja

    Hi
    Please see the below thread and answer your question
    Issue in determining the Person who Rejected the SC item in Sourcing
    Thanks
    Ashish

  • Could you check our source? (To determine the PR type and number range)

    Hello.
    We use SRM Server5.5 with Classic Scenario.
    We will use the BADI BBP_SC_TRANSFER_BE to determine the PR type and number range according to your recommend.
    We have two PR type in R/3.
    1) KGPR
    2) KTR1
    As you know that shopping cart has no type. So we add customer field to mapping to R/3 PR type and this field has two values.
    1)     PR01: mapping to KGPR
    2)     PR02: mapping to KTR1
    We will use the method GROUP_RQ to determine the PR type.
    If customer field is PR01, PR type is determined KGPR
    If customer field is PR002, PR type is determined KTR1.
    To determine the PR number range, we will use the method GET_NUMBER_OR_RANGE.
    If PR type is KGPR, Choose the No key 12
    If PR type is KTR1, Choose the No key 16.
    Configuration step:
    1.     Maintain the PR number range in SRM.
    No key: 12  (for KGPR) internal NR
    No range: 2520000000 – 2529000000
    No key: 16 (for KTR1) internal NR
    No range: 2560000000 – 2569000000
    2.     Maintain the PR number range in R/3
    No key: 12  (for KGPR) Ext NR
    No range: 2520000000 – 2529000000
    No key: 16 (for KTR1) Ext NR
    No range: 2560000000 – 2569000000
    3.     Assign the PR number range to PR type in R/3
    KGPR – 12 (EXT)
    KTR1 – 16 (EXT)
    4.     Maintain the attribute in SRM
    Document type in R/3
          Add KGPR and KTR1
    We developed this logic, but it’s not working.
    LOOP AT ct_proc_item INTO ls_proc_item “ Where is no date in ct_proc_item:
    We can not find out the reason.
    Could you check our source?
    METHOD if_ex_bbp_sc_transfer_be~group_rq.
      DATA:
           ls_proc_item           TYPE bbps_procurement,
           lv_number_int          TYPE bbp_item_no,
           ls_item                TYPE bbp_pds_transfer_item,
           lv_group_counter       TYPE numc5,
      CONSTANTS:
          lc_on(1)               VALUE 'X'.
      SORT ct_proc_item BY obj_to_gen.
      CLEAR: lv_group_counter.
    LOOP AT ct_proc_item INTO ls_proc_item  
    where obj_to_gen eq iv_object_to_generate.
    get item data which includes customer fields
        MOVE ls_proc_item-preq_item TO lv_number_int. " convert
        READ TABLE it_item INTO ls_item WITH KEY number_int = lv_number_int.
        IF sy-subrc = 0.
          IF ls_item-pr_type EQ 'PR01'.
            ls_proc_item-doc_type = 'KGRP'.
          ELSEIF ls_item-pr_type EQ 'PR02'.
            ls_proc_item-doc_type = 'KTR1'.
          ENDIF. " lv_cust_field
          lv_group_counter = lv_group_counter + 1.   " increase counter
          ls_proc_item-group_1 = lv_group_counter.
          MODIFY ct_proc_item FROM ls_proc_item
                 TRANSPORTING group_1.
        ENDIF.  " sy-subrc
      ENDLOOP.
      cv_method_active = lc_on.
    ENDMETHOD.
    method IF_EX_BBP_SC_TRANSFER_BE~GET_NUMBER_OR_RANGE.
      if is_item-pr_type = 'PR01'.
         CV_NUMBER_RANGE = '12'.
         CV_NUMBER = '2520000000'.
      elseif is_item-pr_type = 'PR02'.
         CV_NUMBER_RANGE = '16'.
         CV_NUMBER = '2560000000'.
      endif. " is_proc_item / is_item
    Thank you
    Best Regard
    SH

    Hi
    Please find some suitable sample code, which might help you out.
    method IF_EX_BBP_SC_TRANSFER_BE~GET_NUMBER_OR_RANGE .
    * IV_OBJECT_TO_GENERATE
    *   '1' Reservation
    *   '2' Purchase Requsition (BANF)
    *   '3' Purchase Order
    *   '4' Customer Object
    * 1. current item data are in structures
    *    - IS_ITEM shopping cart item data including Customer Fields
    *    - IS_PROC backend relevant item purchasing data
    * 2. accounting data in tables
    *    - IT_ACCOUNT all shopping cart account. data with Customer Fields
    *    - IT_PROC_ACCOUNT backend relevant accounting data for current item
    *  - key criteria between this tables are
    *    - it_proc_account-preq_item
    *                     -serial_no (numc 2)
    *    - guid from is_item
    *    - it_account-p_guid
    *                -accno(numc 4)
    * A) example to use current item data + item customer fields
    *  if is_proc_item-DOC_TYPE = 'ABCD' AND
    *     is_item-<field of CI_BBP_ITEM> = .
    * set own number range
    *  CV_NUMBER_RANGE = .
    ** set own number
    ** .. ==> if initial SAP Standard with no.range will be processed
    *  CV_NUMBER = .
    *  endif. " is_proc_item / is_item
    * B) example to use only proc_account no accounting customer fields
    *data:
    *     ls_proc_account   type bbp_bapipogna.
    *  loop at it_proc_account
    *            into ls_proc_account.
    *    if ls_proc_account-BUS_AREA = '9988'.
    ** set own number range
    *  CV_NUMBER_RANGE = .
    ** set own number
    ** .. ==> if initial SAP Standard with no.range will be processed
    *  CV_NUMBER = .
    *     endif. " ls_proc_account
    *  endloop.
    * C) example to use only accounting customer fields, no other accounting
    *data:
    *     ls_account        type bbp_pds_acc.
    *  loop at it_account
    *            into ls_account
    *            where p_guid = is_item-guid.
    *    if ls_account-<field of CI_BBP_ACC> = .
    ** set own number range
    *  CV_NUMBER_RANGE = .
    ** set own number
    ** .. ==> if initial SAP Standard with no.range will be processed
    *  CV_NUMBER = .
    *   endif. " ls_account
    *  endloop.
    * D) example to use proc_account + customer fields for accounting
    *data:
    *     lv_serial_no      type bbp_bapipogna-serial_no,  " sequence num 2
    *     lv_acc_no         type bbp_pds_acc-acc_no,       " sequence num 4
    *     ls_proc_account   type bbp_bapipogna,
    *     ls_account        type bbp_pds_acc.
    *  loop at it_proc_account
    *            into ls_proc_account.
    *    move ls_proc_account-serial_no to lv_acc_no.
    *    read table it_account
    *         into ls_account
    *         with key p_guid = is_item-guid
    *                  acc_no = lv_acc_no.
    *    if sy-subrc = 0.
    **     if ls_account-<field of CI_BBP_ACC> = .
    ** set own number range
    **  CV_NUMBER_RANGE = .
    ** set own number
    ** .. ==> if initial SAP Standard with no.range will be processed
    **  CV_NUMBER = .
    **      endif. " ls_account
    *    endif. " sy-subrc
    *  endloop.
    endmethod.
    method IF_EX_BBP_SC_TRANSFER_BE~GROUP_RQ .
    * 1. current item data are in structures
    *    - IT_ITEM all shopping cart item data including Customer Fields
    *    - IT_PROC_ITEM backend relevant item data of current log.system
    *    key criteria between this tables are:
    *    - IT_ITEM-NUMBER_INT (numc 10)
    *    - IT_PROC_ITEM       (numc  5)
    * 2. accounting data in tables
    *    - IT_ACCOUNT all shopping cart account. data incl. Customer Fields
    *    - IT_PROC_ACCOUNT backend relevant accounting data for current item
    *  - key criteria between this tables are
    *    - it_proc_account-preq_item (numc 5)
    *                     -serial_no (numc 2)
    *    - is_item-guid
    *             -number_int (numc 10)
    *    - it_account-p_guid
    *                -accno(numc 4)
    constants:
          lc_on(1)               VALUE 'X'.
    * A) example to use only proc_item with NO customer fields
    *         group requisitions by backend document type
    *data: lv_doc_type            TYPE esart,
    *      ls_proc_item           type BBPS_PROCUREMENT,
    *      lv_group_counter       type numc5.
    *    clear lv_group_counter.
    *    clear lv_doc_type.
    *    SORT ct_proc_item BY obj_to_gen doc_type.
    *    LOOP AT ct_proc_item
    *            into ls_proc_item
    *            WHERE obj_to_gen EQ iv_object_to_generate.
    ** new group criteria?
    *      if lv_doc_type ne ls_proc_item-doc_type.     " backend doc.type
    *        lv_group_counter = lv_group_counter + 1.   " increase counter
    *        lv_doc_type      = ls_proc_item-doc_type.       " save criteria
    *      endif.
    *      ls_proc_item-group_1 = lv_group_counter.
    *      modify ct_proc_item from ls_proc_item
    *             transporting group_1.
    *    ENDLOOP.
    * B) example to use item customer fields
    * data:
    *      ls_proc_item           type BBPS_PROCUREMENT,
    *      lv_cust_field          type <field of ci_bbp_item>.
    *      lv_number_int          type BBP_ITEM_NO,
    *      ls_item                type BBP_PDS_TRANSFER_ITEM.
    *    clear lv_group_counter.
    *    clear lv_cust_field .
    *    SORT ct_proc_item BY obj_to_gen.
    *    LOOP AT ct_proc_item
    *            into ls_proc_item
    *            WHERE obj_to_gen EQ iv_object_to_generate.
    ** get item data which includes customer fields
    *      move ls_proc_item-preq_item to lv_number_int. " convert
    *      read table it_item
    *           into ls_item
    *           with key number_int = lv_number_int.
    *      if sy-subrc = 0.
    **       new group criteria?
    *        if lv_cust_field ne 'XYZ'.
    *         lv_group_counter = lv_group_counter + 1.   " increase counter
    *         lv_cust_field = ls_item-<field of ci_bbp_item>."save criteria
    *        endif. " lv_cust_field
    *        ls_proc_item-group_1 = lv_group_counter.
    *        modify ct_proc_item from ls_proc_item
    *               transporting group_1.
    *      endif.  " sy-subrc
    *    ENDLOOP.
    * C) example to use accounting data with customer fields
    *            group requisitions by backend document type
    *data: lv_doc_type            TYPE esart,
    *      ls_proc_item           type BBPS_PROCUREMENT,
    *      lt_account             type BBPT_PD_ACC,
    *      ls_account             type bbp_pds_acc,
    *      ls_item                type BBP_PDS_TRANSFER_ITEM,
    *      lv_number_int          type BBP_ITEM_NO,
    *      lv_account_flag        type c,
    *      lv_group_counter       type numc5.
    *    clear lv_group_counter.
    *    clear lv_doc_type.
    *    SORT ct_proc_item BY obj_to_gen doc_type.
    *    lt_account[] = it_account[].
    *    SORT lt_account BY p_guid acc_no.
    *    LOOP AT ct_proc_item
    *            into ls_proc_item
    *            WHERE obj_to_gen EQ iv_object_to_generate.
    ** get accounting customer fields for this item
    *    clear lv_account_flag.
    ** ..first get item guid
    *    move ls_proc_item-preq_item to lv_number_int.
    *    read table it_item
    *         into ls_item
    *         with key number_int = lv_number_int.
    *    if sy-subrc = 0.
    *      loop at lt_account
    *           into ls_account
    *           where p_guid = ls_item-guid.
    *        if ls_account-<field of CI_BBP_ACC> = .
    *           lv_account_flag = lc_on.
    *        endif.
    *      endloop.
    *    endif. " sy-subrc it_item
    ** new group criteria?
    *      if lv_doc_type ne ls_proc_item-doc_type OR     " backend doc.type
    *         lv_account_flag = lc_on.                    " accounting
    *        lv_group_counter = lv_group_counter + 1.   " increase counter
    *        lv_doc_type      = ls_proc_item-doc_type.       " save criteria
    *      endif.
    *      ls_proc_item-group_1 = lv_group_counter.
    *      modify ct_proc_item from ls_proc_item
    *             transporting group_1.
    *    ENDLOOP.
    * !!!! set flag that BADI was processed
    * .. ==> no SAP Standard grouping will be processed
        cv_method_active = lc_on.
    endmethod.
    Hope this will help.
    Please reward suitable points, incase it suits your requirements.
    Regards
    - Atul

  • In Iproc : The system could not determine the internal source for item

    We faced the following error in the Iprocurement
    The system could not determine the internal source for item.
    kindly note that the item is :
    - customer ordered
    - customer ordered Enabled
    - Shippable
    -Internal Ordered
    -internal ordered enabled
    - OE Transactable
    - assigned to a valid organisation
    -assigned to mapped category
    - Assignment Set is Created  +Profile option
    -profile options for internally sourced is set to yes
    If there is any missing or set please let me know
    , best regards
    Tareq

    hi Kartik
    Please check whether your company is opted for " business area financial statments" in financial account- global setting of company code. If yes and you want to continue please maintain business area for the plant and material dvision combination under the transaction cde OVF0.
    Hope this will solve your problem.

  • What are the sources system will pick the document type while creating invo

    hi
    I would like to know how system will pickup the doucment type while creating invoice in vf01.
    i have taken off the fields  f1, f2, from the document type. in billing sub tab.  so  The moment when am creating billing system automatically displaying F2 invoice doucment creation.  What are the sources for this.
    thanks & Regards
    Rack129

    Hi,
    Hope you have maintained u2018Delivery relevant billing type F2u2019 and u2018Order relevant billing type F1u2019 in the billing tab of the Sales document type in VOV8.
    If you create delivery related billing, the system will pick F2. This is controlled in Item category (VOV7). Billing relevance in Business data of Item category decides whether this is delivery related or order related. u2018Au2019 for delivery related billing; u2018Bu2019 for order related billing and so on.
    Item category is determined by this combination: Sales document type + Item cat group + usage + higher level item cat.
    Regards,
    K Bharathi

  • HT1481 I have an ipod shuffle which i need to reset as i can not sinc it on my laptop which is using windows 8, but when i open itunes i d not have the 'source panel' on the left hand side which should show up my ipod. any ideas what i need to do? please

    Hi  I have an ipod shuffle which worked well on my old pc but since i have tried to link it with my new laptop I cant get it to sinc. I have athorised the device to my laptop so i thought it maybe worth resetting it but all the info I have read tells me that to reset my ipod i need to open i tunes and on the left hand side in the 'source panel' i will find my ipod listed but when i open itunes i do not have a source panel so i cant reset it. i have spent days trying to get this problem sorted and am about to throw the thing away. I have tried to manually sinc the thing, i have installed and reinstalled the latest version of itunes, i have restarted my laptop but i dont know what to do next. any help would be very much appreciated. Many thanks in advance

    See
    iOS: Device not recognized in iTunes for Windows
    - I would start with
    Removing and Reinstalling iTunes, QuickTime, and other software components for Windows XP
    or              
    Removing and reinstalling iTunes and other software components for Windows Vista, Windows 7, or Windows 8
    However, after your remove the Apple software components also remove the iCloud Control Panel via Windows Programs and Features app in the Window Control Panel. Then reinstall all the Apple software components
    - New cable and different USB port
    - Run this and see if the results help with determine the cause
    iTunes for Windows: Device Sync Tests
    Also see:
    iPod not recognised by windows iTunes
    Troubleshooting issues with iTunes for Windows updates
    - Try on another computer to help determine if computer or iPod problem

  • How Can I Determine the Size of the 'My Documents' Folder for every user on a local machine using VBScript?

    Hello,
    I am at my wits end into this. Either I am doing it the wrong way or it is not possible.
    Let me explain. I need a vb script for the following scenario:
    1. The script is to run on multiple Windows 7 machines (32-Bit & 64-Bit alike).
    2. These are shared workstation i.e. different users login to these machines from time to time.
    3. The objective of this script is to traverse through each User Profile folder and get the size of the 'My Documents' folder within each User Profile folder. This information is to be written to a
    .CSV file located at C:\Temp directory on the machine.
    4. This script would be pushed to all workstations from SCCM. It would be configured to execute with
    System Rights
    I tried the script detailed at:
    http://blogs.technet.com/b/heyscriptingguy/archive/2005/03/31/how-can-i-determine-the-size-of-the-my-documents-folder.aspx 
    Const MY_DOCUMENTS = &H5&
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.Namespace(MY_DOCUMENTS)
    Set objFolderItem = objFolder.Self
    strPath = objFolderItem.Path
    Set objFolder = objFSO.GetFolder(strPath)
    Wscript.Echo objFolder.Size
    The Wscript.Echo objFolder.Size command in the script at the above mentioned link returned the value as
    '0' (zero) for the current logged on user. Although the actual size was like 30 MB or so.
    I then tried the script at:
    http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_27869829.html
    This script returns the correct value but only for the current logged-on user.
    Const blnShowErrors = False
    ' Set up filesystem object for usage
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objShell = CreateObject("WScript.Shell")
    ' Display desired folder sizes
    Wscript.Echo "MyDocuments : " & FormatSize(FindFiles(objFSO.GetFolder(objShell.SpecialFolders("MyDocuments"))))
    ' Recursively tally the size of all files under a folder
    ' Protect against folders or files that are not accessible
    Function FindFiles(objFolder)
    On Error Resume Next
    ' List files
    For Each objFile In objFolder.Files
    On Error Resume Next
    If Err.Number <> 0 Then ShowError "FindFiles:01", objFolder.Path
    On Error Resume Next
    FindFiles = FindFiles + objFile.Size
    If Err.Number <> 0 Then ShowError "FindFiles:02", objFile.Path
    Next
    If Err.Number = 0 Then
    ' Recursively drill down into subfolder
    For Each objSubFolder In objFolder.SubFolders
    On Error Resume Next
    If Err.Number <> 0 Then ShowError "FindFiles:04", objFolder.Path
    FindFiles = FindFiles + FindFiles(objSubFolder)
    If Err.Number <> 0 Then ShowError "FindFiles:05", objSubFolder.Path
    Next
    Else
    ShowError "FindFiles:03", objFolder.Path
    End If
    End Function
    ' Function to format a number into typical size scales
    Function FormatSize(iSize)
    aLabel = Array("bytes", "KB", "MB", "GB", "TB")
    For i = 0 to 4
    If iSize > 1024 Then iSize = iSize / 1024 Else Exit For End If
    Next
    FormatSize = Round(iSize, 2) & " " & aLabel(i)
    End Function
    Sub ShowError(strLocation, strMessage)
    If blnShowErrors Then
    WScript.StdErr.WriteLine "==> ERROR at [" & strLocation & "]"
    WScript.StdErr.WriteLine " Number:[" & Err.Number & "], Source:[" & Err.Source & "], Desc:[" & Err.Description & "]"
    WScript.StdErr.WriteLine " " & strMessage
    Err.Clear
    End If
    End Sub
    The only part pending, is to achieve this for the 'My Documents' folder within each User Profile folder.
    Is this possible?
    Please help.

    Here are a bunch of scripts to get folder size under all circumstances.  Take your pick.
    https://gallery.technet.microsoft.com/scriptcenter/site/search?query=get%20folder%20size&f%5B0%5D.Value=get%20folder%20size&f%5B0%5D.Type=SearchText&ac=2
    ¯\_(ツ)_/¯

Maybe you are looking for