Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Collect the share folder and file path and disk size usage  (Read 3773 times)

0 Members and 1 Guest are viewing this topic.

sun_os

    Topic Starter


    Beginner

    Dear All,

    I want to use the batch to collect share folder , sub-directory and file path , disk usage from the server in Domain. 
    I try to use diruse from support tool but it is not fit my expectation.

    My format is one column

    Total Number of folders , TotalNumber of files, Total number of file and folders usage in MB

    Please kindly help me what is batch or script can get such information at that way.

    Thanks,
    Alfred

    foxidrive



      Specialist
    • Thanked: 268
    • Experience: Experienced
    • OS: Windows 8
    Re: Collect the share folder and file path and disk size usage
    « Reply #1 on: March 25, 2015, 06:28:12 AM »
    I want to use the batch to collect share folder

    Is this a mapped drive?  How is the server accessed?  Does it require authentication for the user?

    Quote
    My format is one column

    Total Number of folders , TotalNumber of files, Total number of file and folders usage in MB

    What kind of MB do you expect?  1,000,000 bytes = 1 MB ?

    If the number of files and folder over a LAN are huge, then this could be a very slow task. 
    Have you considered that?

    sun_os

      Topic Starter


      Beginner

      Re: Collect the share folder and file path and disk size usage
      « Reply #2 on: March 25, 2015, 10:29:35 AM »
      Yes, MB = 1 MB capacity in MB

      Just want to check the number of folder on the share drives

      Let me take example , I have the server to be share HOME Drive

      I want to get some information how many folders and files are in the home drive.  How many those files and folders in usage

      I just want to know the script or command in window

      I use diruse to get such information , but it is not enough


      foxidrive



        Specialist
      • Thanked: 268
      • Experience: Experienced
      • OS: Windows 8
      Re: Collect the share folder and file path and disk size usage
      « Reply #3 on: March 25, 2015, 09:43:10 PM »
      Do you access the drive with a drive letter? 

      EG: do you use h: to access the home drive?

      Can you give an example of the output you need, showing a few lines of numbers etc?
      Does it need to be formatted in a special way with tabs or padded columns etc?

      sun_os

        Topic Starter


        Beginner

        Re: Collect the share folder and file path and disk size usage
        « Reply #4 on: March 26, 2015, 03:24:58 AM »
        I just upload the result layout for your reference

        I use diruse and dir /s/b /a:d to search total no. of files, share drive usage and no. of folders and subfolders information.

        I m admin so I can access all the share drive. I run the command on the target server to get such information.

        Thank you

        [attachment deleted by admin to conserve space]

        foxidrive



          Specialist
        • Thanked: 268
        • Experience: Experienced
        • OS: Windows 8
        Re: Collect the share folder and file path and disk size usage
        « Reply #5 on: March 26, 2015, 06:38:13 AM »
        The answers you've given to my questions are unclear, and not really what I've asked.

        The task should be fairly easy, but without the info I have asked you for - you may come back
        and say it doesn't work or you want something different - and it's no fun having to do things twice
        just because the task isn't well described.

        Nowhere has an excel file been mentioned...

        sun_os

          Topic Starter


          Beginner

          Re: Collect the share folder and file path and disk size usage
          « Reply #6 on: March 26, 2015, 09:45:48 PM »
          Hi

          I use the share drive on D:HOME

          I just want to get the such spreedsheet information by script.

          diruse  ; Show the total size of folder and number of files but not show to number of subfolder

              Size (mb)  Files  Directory
                  24.18    102  C:\SUPPORT_TOOLS
                   3.20      3  C:\SUPPORT_TOOLS\ProcessExploreNT
                  27.38    105  SUB-TOTAL: C:\SUPPORT_TOOLS

          dir /s/b/a:d : Show the number of folder and subfolders as well
          C:\support_tools\ProcessExploreNT

          dir /s/b /a:d

                  27.38    105  TOTAL: C:\SUPPORT_TOOLS

          foxidrive



            Specialist
          • Thanked: 268
          • Experience: Experienced
          • OS: Windows 8
          Re: Collect the share folder and file path and disk size usage
          « Reply #7 on: March 27, 2015, 04:35:33 AM »
          You can have the data in a .csv file

          This is not thoroughly tested - see how it works for you.

          Code: [Select]
          @echo off
          (
          echo TOT_FOLDERS,TOT_FILES,TOT_SIZE,FOLDER
          rem parse each folder
          for /f "delims=" %%a in ('dir /a:d /o:n /b /-p') do (
          rem collect files
          for /f "delims=" %%b in ('dir "%%a" /b /s /-p /a-d ^|find /c /v ""') do (
          rem collect folders
          for /f "delims=" %%c in ('dir "%%a" /b /s /-p /ad  ^|find /c /v ""') do (
          rem collect total size
          for /f "tokens=2,*" %%d in ('dir "%%a" /s /-p ^|find " File(s) " ') do set totalsize=%%e
          setlocal enabledelayedexpansion
          echo %%c,%%b,"!totalsize!","%%~fa"
          endlocal
          )
          )
          )
          )>"total.csv"

          sun_os

            Topic Starter


            Beginner

            Re: Collect the share folder and file path and disk size usage
            « Reply #8 on: March 28, 2015, 11:19:56 PM »
            Thank you for your effort to build the code for me

            I check the output , it can't show the total file size and folder size

            May I know is it something wrong on the command



            [attachment deleted by admin to conserve space]

            foxidrive



              Specialist
            • Thanked: 268
            • Experience: Experienced
            • OS: Windows 8
            Re: Collect the share folder and file path and disk size usage
            « Reply #9 on: March 29, 2015, 08:04:48 AM »
            Thank you for your effort to build the code for me
            I check the output , it can't show the total file size and folder size
            May I know is it something wrong on the command

            I'm guessing that your Windows is not an English build.

            This is what I see here in a test:

            TOT_FOLDERS,TOT_FILES,TOT_SIZE,FOLDER
            0,8,"11,796,480 bytes","d:\Backup\Vox\Images"
            21,58,"52,505,656,317 bytes","d:\Backup\Vox\Machines"

            sun_os

              Topic Starter


              Beginner

              Re: Collect the share folder and file path and disk size usage
              « Reply #10 on: March 29, 2015, 07:59:09 PM »
              Hi,

              My domain window are built in the English version

              foxidrive



                Specialist
              • Thanked: 268
              • Experience: Experienced
              • OS: Windows 8
              Re: Collect the share folder and file path and disk size usage
              « Reply #11 on: March 30, 2015, 01:09:54 AM »
              My domain window are built in the English version

              I'm afraid I don't know what your domain window is.

              On the computer you are launching the batch script on,  please open a cmd prompt and type the command
              dir and then copy and paste the bottom 12 lines or so into a reply
               - so I can isolate where the problem is.

              sun_os

                Topic Starter


                Beginner

                Re: Collect the share folder and file path and disk size usage
                « Reply #12 on: March 30, 2015, 10:54:27 AM »
                I run the bat file on the server, it can get the result, but the some share folder contain  chinese file name and long file name. It outputs the file is too long. It is not my expectation for such situation on the end users to save in long chinese file name

                Sorry I don't mention that issues from share drive   

                [attachment deleted by admin to conserve space]