How can I see size of folders directly in Detail View list?

Discussion in 'Windows 10' started by Katzenfreund, Jul 16, 2016.

  1. Katzenfreund

    Katzenfreund MDL Expert

    Jul 15, 2016
    1,372
    809
    60
  2. Bat.1

    Bat.1 MDL Addicted

    Oct 18, 2014
    810
    790
    30
    Editting the title of the other thread to something like Working with folders might have been a better idea than creating a new thread :)
     
  3. Nucleus

    Nucleus MDL Guru

    Aug 4, 2009
    2,874
    2,924
    90
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. Katzenfreund

    Katzenfreund MDL Expert

    Jul 15, 2016
    1,372
    809
    60
    Is this the official policy? Because I'd intuitively suppose that keeping subjects separate facilitates clarity, searching for titles and avoidance of cross-posting confusion. I have also noticed that some threads got very long and off-putting.

    But if it's how things are done here, of course I'll comply.
     
  5. Enthousiast

    Enthousiast MDL Tester

    Oct 30, 2009
    15,504
    18,620
    340
    There are no rules but sometimes one starts 10 seperate threads for every single question.
     
  6. kaljukass

    kaljukass MDL Addicted

    Nov 26, 2012
    878
    298
    30
    #7 kaljukass, Jul 16, 2016
    Last edited by a moderator: Apr 20, 2017
    If someone want to use or develop this simple vbs script, which usually sends csv file from selected folder content to the current user desktop, then do it.
    Why is selected csv file - simply then You can see it more correctly using spredsheets (exel) table. But of course, it can be opened also using any kind of text editor.
    Here is two versions, the first sends file where content size is in megabytes(MB), the other in kilobytes (kB).
    NB! You can copy this script to Notebad and save as file.vbs using encoding "Unicode".
    Code 1 (Size is in MB)
    Code:
    '==========================================================================
    ' NAME: folderSize.vbs
    ' COMMENT: Scans folder sizes of a selected folder.
    '==========================================================================
    Dim objFSO, objFolder, objFile, objFile2, F, myVar1, myVar2, folderCount, strWrite
    
    
    folderCount = 0
    objFile2 = "folderdetails.csv"
    
    
    Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
    Call browseFolder(strFolderSrc,"Source")
    Set objFolder = objFSO.GetFolder(strFolderSrc)
    
    
    'Write Header Row
    Set objFile = CreateObject("Scripting.FileSystemObject")   
    Set strWrite = objFile.OpenTextFile(objFile2, 2, True)
    strWrite.WriteLine("Folder Name,Size (MB),# Files,# Sub Folders")
    Wscript.Sleep 300
    
    
    ShowFolderDetails objFolder
    
    
    strWrite.Close
    
    
    MsgBox "Complete."
    
    
    Set objFSO = Nothing
    Set objFolder = Nothing
    Set objFile = Nothing
    Set objFile2 = Nothing
    Set F = Nothing
    Set myVar1 = Nothing
    Set myVar2 = Nothing
    Set strWrite = Nothing
    
    
    WScript.Quit
      
    '==========================================================================
    'Functions
    Function ShowFolderDetails(oF)
        strWrite.WriteLine(oF.Name + "," + CStr(oF.Size /1024\1024) + "," + CStr(oF.Files.Count) + "," + CStr(oF.Subfolders.Count))
    
    
        'Comment out the following line and the loop to end the statement
        'to list all subfolders.(End Loop is 6 lines down)
        Do While folderCount < 1
        for each F in oF.Subfolders
            ShowFolderDetails F
        Next
        folderCount = folderCount + 1
        Loop
    End Function
    
    
    ' browseFolder brings up the selection box to choose both the source and the destination.
    Function browseFolder(myVar1,myVar2)
    Const WINDOW_HANDLE = 0
    Const NO_OPTIONS = 0
    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.BrowseForFolder _
        (WINDOW_HANDLE, "Select a " & myVar2 & " folder:", NO_OPTIONS, "C:\Scripts")
    On Error Resume Next
    Set objFolderItem = objFolder.Self
    objPath = objFolderItem.Path
    myVar1 = objPath
    Call objPathChk(myVar1)
    End Function
    
    
    ' objPathChk checks to make sure that a source has been selected.
    Function objPathChk(myVar1)
    If myVar1 = "" Then
    MsgBox "Scan Folder Not Specified." & VbCrLf & _
    "Scan will now quit.", vbOKOnly, "Terminate"
    WScript.Quit
    End If
    End Function
    '==========================================================================
    
    Code 2 (Size is in kB)
    Code:
    '==========================================================================
    ' NAME: folderSize.vbs
    ' COMMENT: Scans folder sizes of a selected folder.
    '==========================================================================
    Dim objFSO, objFolder, objFile, objFile2, F, myVar1, myVar2, folderCount, strWrite
    
    
    folderCount = 0
    objFile2 = "folderdetails.csv"
    
    
    Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
    Call browseFolder(strFolderSrc,"Source")
    Set objFolder = objFSO.GetFolder(strFolderSrc)
    
    
    'Write Header Row
    Set objFile = CreateObject("Scripting.FileSystemObject")   
    Set strWrite = objFile.OpenTextFile(objFile2, 2, True)
    strWrite.WriteLine("Folder Name,Size (kB),# Files,# Sub Folders")
    Wscript.Sleep 300
    
    
    ShowFolderDetails objFolder
    
    
    strWrite.Close
    
    
    MsgBox "Complete."
    
    
    Set objFSO = Nothing
    Set objFolder = Nothing
    Set objFile = Nothing
    Set objFile2 = Nothing
    Set F = Nothing
    Set myVar1 = Nothing
    Set myVar2 = Nothing
    Set strWrite = Nothing
    
    
    WScript.Quit
      
    '==========================================================================
    'Functions
    Function ShowFolderDetails(oF)
        strWrite.WriteLine(oF.Name + "," + CStr(oF.Size /1024) + "," + CStr(oF.Files.Count) + "," + CStr(oF.Subfolders.Count))
    
    
        'Comment out the following line and the loop to end the statement
        'to list all subfolders.(End Loop is 6 lines down)
        Do While folderCount < 1
            for each F in oF.Subfolders
                ShowFolderDetails F
            Next
            folderCount = folderCount + 1
        Loop
    End Function
    
    
    ' browseFolder brings up the selection box to choose both the source and the destination.
    Function browseFolder(myVar1,myVar2)
        Const WINDOW_HANDLE = 0
        Const NO_OPTIONS = 0
        Set objShell = CreateObject("Shell.Application")
        Set objFolder = objShell.BrowseForFolder _
            (WINDOW_HANDLE, "Select a " & myVar2 & " folder:", NO_OPTIONS, "C:\Scripts")
        On Error Resume Next
        Set objFolderItem = objFolder.Self
        objPath = objFolderItem.Path
        myVar1 = objPath
        Call objPathChk(myVar1)
    End Function
    
    
    ' objPathChk checks to make sure that a source has been selected.
    Function objPathChk(myVar1)
        If myVar1 = "" Then
            MsgBox "Scan Folder Not Specified." & VbCrLf & _
                    "Scan will now quit.", vbOKOnly, "Terminate"
            WScript.Quit
        End If        
    End Function
    '==========================================================================
    
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. 100

    100 MDL Expert

    May 17, 2011
    1,346
    1,542
    60
  8. T-S

    T-S MDL Guru

    Dec 14, 2012
    3,988
    1,316
    120
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. ofernandofilo

    ofernandofilo MDL Member

    Sep 26, 2015
    211
    128
    10
    #10 ofernandofilo, Jul 16, 2016
    Last edited: Jul 16, 2016
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. Katzenfreund

    Katzenfreund MDL Expert

    Jul 15, 2016
    1,372
    809
    60
    Thanks 100 for both clarifications.

    T-S also has me convinced, especially since hovering the mouse over a file shows its size fast enough, while third party progs also do it, as suggested by Nucleus. And, of course, old XP had no difficulty either (here we go again).

    But then, Win 10 has to accommodate all those gimmicks, bells and whistles, not to mention intensive data gathering. Now, if instead of gathering data on the user it was gathering them on files and folders, it wouldn’t have trouble with showing basic info about them.
     
  11. Katzenfreund

    Katzenfreund MDL Expert

    Jul 15, 2016
    1,372
    809
    60
    When I was new at my job, I used to include several items in a letter to someone, e.g. another company. I thought I was being efficient this way. But soon I noticed that it confused them and also they were only answering some of the points and ignored others that apparently did not suit them. So I had to send reminders and follow-up letters.

    Consequently, I changed policy and kept different subjects separate, using ad hoc letters, and the problem was solved.

    P.S. You’ll notice, I’ve used two posts to deal with the two different subjects being discussed. :)
     
  12. T-S

    T-S MDL Guru

    Dec 14, 2012
    3,988
    1,316
    120

    Also keep in mind that there's a third way.

    A good alternate file manager.

    There are many out there and usually they are way more rich than the basic win explorer.

    XYexplorer or Qdir just to mention two of them
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  13. pf100

    pf100 MDL Addicted

    Oct 22, 2010
    949
    1,095
    30