Get Folder Size from Windows Command Line

前端 未结 17 2344
滥情空心
滥情空心 2020-11-28 18:52

Is it possible in Windows to get a folder\'s size from the command line without using any 3rd party tool?

I want the same result as you would get when right clicking

17条回答
  •  自闭症患者
    2020-11-28 19:46

    I got du.exe with my git distribution. Another place might be aforementioned Microsoft or Unxutils.

    Once you got du.exe in your path. Here's your fileSizes.bat :-)

    @echo ___________
    @echo DIRECTORIES
    @for /D %%i in (*) do @CALL du.exe -hs "%%i"
    @echo _____
    @echo FILES
    @for %%i in (*) do @CALL du.exe -hs "%%i"
    @echo _____
    @echo TOTAL
    @du.exe -sh "%CD%"
    

    ___________
    DIRECTORIES
    37M     Alps-images
    12M     testfolder
    _____
    FILES
    765K    Dobbiaco.jpg
    1.0K    testfile.txt
    _____
    TOTAL
    58M    D:\pictures\sample
    

提交回复
热议问题